Fix Debian install script

This commit is contained in:
Arinerron 2019-03-30 16:36:50 -07:00
parent 50d0366e47
commit 00d9ae975e
No known key found for this signature in database
GPG Key ID: 99383627861C62F0
3 changed files with 9 additions and 9 deletions

View File

@ -5,7 +5,7 @@ OUTPUT_DIR='/usr/share/onionr'
DATA_DIR='/etc/onionr' DATA_DIR='/etc/onionr'
LOG_DIR='/var/log/onionr' LOG_DIR='/var/log/onionr'
BRANCH='master' BRANCH='easy-releases'
# setup error handlers # setup error handlers
@ -43,12 +43,10 @@ echo -e "\033[0;32mInstalling pip dependencies...\033[0m"
python3.7 -m pip install --no-input -r "$OUTPUT_DIR/requirements.txt" --require-hashes > /dev/null python3.7 -m pip install --no-input -r "$OUTPUT_DIR/requirements.txt" --require-hashes > /dev/null
# create nologin onionr user if not exists # set permissions on Onionr directory
id -u onionr &>/dev/null || useradd -r -s /bin/false onionr
chmod 755 "$OUTPUT_DIR" chmod 755 "$OUTPUT_DIR"
chown -R onionr:onionr "$OUTPUT_DIR" chown -R root:root "$OUTPUT_DIR"
# create directories # create directories
@ -56,7 +54,7 @@ mkdir -p "$OUTPUT_DIR/onionr/data" "$LOG_DIR"
mv "$OUTPUT_DIR/onionr/data" "$DATA_DIR" mv "$OUTPUT_DIR/onionr/data" "$DATA_DIR"
chmod -R 750 "$DATA_DIR" "$LOG_DIR" chmod -R 750 "$DATA_DIR" "$LOG_DIR"
chown -R onionr:onionr "$DATA_DIR" "$LOG_DIR" chown -R root:root "$DATA_DIR" "$LOG_DIR"
# create executable # create executable
@ -67,6 +65,8 @@ chown root:root "$EXECUTABLE"
# create systemd service # create systemd service
echo -e "\033[0;32mCreating systemd unit...\033[0m"
SERVICE='/etc/systemd/system/onionr.service' SERVICE='/etc/systemd/system/onionr.service'
cp "$OUTPUT_DIR/install/onionr.service" "$SERVICE" cp "$OUTPUT_DIR/install/onionr.service" "$SERVICE"

View File

@ -2,8 +2,6 @@
set -e set -e
[ "root" != "$USER" ] && exec sudo $0 "$@"
export OUTPUT_DIR=${OUTPUT_DIR:=/usr/share/onionr} export OUTPUT_DIR=${OUTPUT_DIR:=/usr/share/onionr}
if [ -n "$HOME" ]; then if [ -n "$HOME" ]; then
@ -18,5 +16,7 @@ fi
mkdir -p "$ONIONR_HOME" "$LOG_DIR" mkdir -p "$ONIONR_HOME" "$LOG_DIR"
chmod -R 700 "$ONIONR_HOME" "$LOG_DIR"
cd "$OUTPUT_DIR/onionr" cd "$OUTPUT_DIR/onionr"
exec python3.7 onionr.py "$@" exec python3.7 onionr.py "$@"

View File

@ -4,11 +4,11 @@ Requires=network.target tor.service
After=network.target tor.service After=network.target tor.service
[Service] [Service]
Type=simple
Environment="DATA_DIR=/usr/share/onionr" Environment="DATA_DIR=/usr/share/onionr"
Environment="LOG_DIR=/var/log/onionr/" Environment="LOG_DIR=/var/log/onionr/"
ExecStart=/usr/bin/onionr --start ExecStart=/usr/bin/onionr --start
ExecStop=/usr/bin/onionr --stop ExecStop=/usr/bin/onionr --stop
Type=simple
Restart=always Restart=always
[Install] [Install]