40 lines
1021 B
Bash
40 lines
1021 B
Bash
#!/bin/sh
|
|
|
|
# [0] Exit if no argument
|
|
test $# -lt 1 && exit;
|
|
|
|
# [1] first install (install source code)
|
|
if [ -e /home/sats/satsd/first_install ]; then
|
|
|
|
dpkg -s git 2>/dev/null >/dev/null && usegit=1 || usegit=0;
|
|
|
|
# install source code
|
|
if [ $usegit -eq 1 ]; then
|
|
|
|
git clone ssh://smmp-server/satsd/git /home/sats/satsd/source \
|
|
&& rm /home/sats/satsd/first_install \
|
|
|| exit;
|
|
|
|
else
|
|
|
|
# temporary replacement (without git)
|
|
scp -r smmp-server:/satsd/scp/source /home/sats/satsd/ \
|
|
&& rm /home/sats/satsd/first_install \
|
|
|| exit;
|
|
fi;
|
|
|
|
fi;
|
|
|
|
|
|
# [2] Propagate script
|
|
if [ "$1" = "daemon" ]; then
|
|
|
|
sh /home/sats/satsd/source/daemon $* 2>> /home/sats/satsd/log/daemon.log >> /home/sats/satsd/log/daemon.log;
|
|
|
|
elif [ "$1" = "update" ]; then
|
|
|
|
sh /home/sats/satsd/source/update 2>> /home/sats/satsd/log/update.log >> /home/sats/satsd/log/update.log;
|
|
|
|
fi;
|
|
|