Skip to content

Commit

Permalink
Improve install/uninstall scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffail committed Jan 18, 2015
1 parent 4f431e3 commit 7f54319
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions config/init.d/leaps
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: Leaps
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Required-Start: $local_fs $network $time $syslog
# Required-Stop: $local_fs $network $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Leaps is a service that hosts collaborative and shared documents for important people.
Expand All @@ -12,7 +12,7 @@ DAEMON=/usr/sbin/leaps
NAME=leaps

RUNAS=leaps
CONFIG=/etc/leaps.yaml
CONFIG=/etc/leaps/config.yaml

PID=/var/run/leaps.pid
LOG=/var/log/leaps.log
Expand Down
15 changes: 9 additions & 6 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
id -u leaps &>/dev/null || (useradd -s /bin/bash leaps && echo leaps:leaps | chpasswd)

cp ./leaps /usr/sbin/leaps

Expand All @@ -13,9 +12,13 @@ if [ ! -f /etc/leaps/config.yaml ]; then
./leaps --print-yaml > /etc/leaps/config.yaml
fi

# cp ./config/init.d/leaps /etc/init.d/leaps
# chmod 755 /etc/init.d/leaps
# chown root:root /etc/init.d/leaps
if [[ "$1" == "--daemon" ]]; then
echo "Setting up init.d script and leaps user ..."
id -u leaps &>/dev/null || (useradd -s /bin/bash leaps && echo leaps:leaps | chpasswd)

# sudo update-rc.d leaps defaults
# sudo update-rc.d leaps enable
cp ./config/init.d/leaps /etc/init.d/leaps
chmod 755 /etc/init.d/leaps
chown root:root /etc/init.d/leaps

update-rc.d leaps start 30 2 3 4 5 . stop 30 0 1 6 .
fi
4 changes: 2 additions & 2 deletions scripts/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ fi
userdel leaps
rm -f /usr/sbin/leaps

echo "Do you wish to keep the /etc/leaps directory? [y]/n"
echo "Do you wish to keep the /etc/leaps directory? Y/n"
read answer

if [[ "$answer" != "n" && "$answer" != "N" ]]; then
if [[ "$answer" == "n" || "$answer" == "N" ]]; then
rm -rf /etc/leaps
fi

0 comments on commit 7f54319

Please sign in to comment.