Add more sample configuration and utility files
[girocco.git] / toolbox / updateroot.sh
blobf96bdcf1bf9e98ddf79ae4a857749cee93d8a012
1 #!/bin/sh
3 # See ../cron/README and ../screen/README
5 if [ "$(id -u)" -ne 0 ]; then
6 echo "ERROR: Must be run as root"
7 exit 1
8 fi
10 set -e
12 basedir=@basedir@
14 FILES=''
15 FILES="$FILES fixupd/README fixupd/fixup.sh fixupd/fixupd.sh"
16 FILES="$FILES toolbox/run-fixupd.sh screen/root"
18 umask 022
19 CPFLAGS=--preserve=timestamps
21 echo "*** Checking for source files ($basedir)..."
22 bad=
23 for sf in $FILES; do
24 if [ ! -r "$basedir/$sf" ]; then
25 bad=1
26 echo "ERROR: Missing source file $basedir/$sf"
28 done
29 if [ -n "$bad" ]; then
30 echo "ERROR: Some source files missing, cannot copy"
31 exit 1
34 echo "*** Setting up root scripts (~root/repomgr)..."
35 mkdir -p ~root/repomgr/fixupd ~root/repomgr/toolbox ~root/repomgr/screen
36 chown -R 0:0 ~root/repomgr
37 chmod -R u+w,go-w ~root/repomgr
38 for sf in $FILES; do
39 cp $CPFLAGS "$basedir/$sf" ~root/repomgr/$sf.new
40 done
41 chown -R 0:0 ~root/repomgr
42 chmod -R u+w,go-w ~root/repomgr
43 for sf in $FILES; do
44 mv -f ~root/repomgr/$sf.new ~root/repomgr/$sf
45 done
46 echo "--- ~root/repomgr created/updated"
47 echo "--- Restart the fixupd.sh script if needed"
48 echo "--- Add $basedir/crontab/girocco to /etc/cron.d/"