updated on Thu Jan 19 12:17:07 UTC 2012
[aur-mirror.git] / guestd / guestd
blob28ee9a88a3a56186f5830492948e8513136f1091
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 OLD_IFS="$IFS"
7 IFS=$'\n'
8 KEEP=`cat /home/guest-permanent/.keep`
10 case "$1" in
11 start)
12 stat_busy "Fixing Guest Directory"
13 cp -R /home/guest-permanent -T /home/guest
14 chown -R guest:guest /home/guest /home/guest-permanent
15 chmod -R 770 /home/guest
16 chmod -R 550 /home/guest-permanent
17 stat_done
18 add_daemon guestd
20 stop)
21 stat_busy "Removing Guest Directory"
22 if [ -d /home/guest ]; then
23 for keeping in ${KEEP[@]}; do
24 if [ -e /home/guest/$keeping ]; then
25 cp -rf /home/guest/$keeping -T /home/guest-permanent/$keeping
27 done
28 rm -rf /home/guest
29 stat_done
30 rm_daemon guestd
31 else
32 echo "Failed to remove directory; directory does not exist."
33 stat_fail
34 rm_daemon guestd
37 restart)
38 $0 stop
39 sleep 1
40 $0 start
43 echo "usage: $0 {start|stop|restart}"
44 esac