File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
# This script will prepare NetBox to run after the code has been upgraded to
3
3
# its most recent release.
4
4
#
5
5
# Once the script completes, remember to restart the WSGI service (e.g.
6
6
# gunicorn or uWSGI).
7
7
8
+ # Optionally use sudo if not already root, and always prompt for password
9
+ # before running the command
10
+ PREFIX=" sudo -k "
11
+ if [ " $( whoami) " = " root" ]; then
12
+ # When running upgrade as root, ask user to confirm if they wish to
13
+ # continue
14
+ read -n1 -rsp $' Running NetBox upgrade as root, press any key to continue or ^C to cancel\n '
15
+ PREFIX=" "
16
+ fi
17
+
8
18
# Install any new Python packages
9
- echo " Updating required Python packages (pip install -r requirements.txt --upgrade)..."
10
- sudo pip install -r requirements.txt --upgrade
19
+ COMMAND=" ${PREFIX} pip install -r requirements.txt --upgrade"
20
+ echo " Updating required Python packages ($COMMAND )..."
21
+ eval $COMMAND
11
22
12
23
# Apply any database migrations
13
24
./netbox/manage.py migrate
You can’t perform that action at this time.
0 commit comments