1 |
a1471122
|
Donato Florio
|
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
DATUM="$(date +%d-%b-%Y-ore-%H-%M)"
|
4 |
|
|
|
5 |
|
|
# ## Set the folder of clonezilla on the fuss-server if not corresponding to the actual standard ## #
|
6 |
|
|
|
7 |
|
|
clonezillaFolder="/srv/clonezilla"
|
8 |
|
|
|
9 |
|
|
tftpFolder="/srv/tftp"
|
10 |
|
|
|
11 |
|
|
####
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
# Check if this version of the "squash-file" is the same. If so do nothing.
|
15 |
|
|
|
16 |
|
|
checkThisSquash="$(md5sum filesystem.squashfs | awk '{print $1}')"
|
17 |
|
|
checkServerSquash="$(md5sum $tftpFolder/clonezilla/live/filesystem.squashfs | awk '{print $1}')"
|
18 |
|
|
|
19 |
|
|
if [ "$checkThisSquash" != "$checkServerSquash" ];then
|
20 |
|
|
mv $tftpFolder/clonezilla/live/filesystem.squashfs $tftpFolder/clonezilla/live/filesystem.squashfs.BKP-$DATUM
|
21 |
|
|
cp filesystem.squashfs $tftpFolder/clonezilla/live/
|
22 |
|
|
fi
|
23 |
|
|
|
24 |
|
|
# ######
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
if [ -e /root/.ssh/authorized_keys ];then
|
28 |
|
|
cp /root/.ssh/authorized_keys /root/.ssh/authorized_keys.BKP-$DATUM
|
29 |
|
|
fi
|
30 |
|
|
|
31 |
|
|
grep root@g450ddd /root/.ssh/authorized_keys >/dev/null
|
32 |
|
|
|
33 |
|
|
if [ $? -eq 0 ]; then
|
34 |
|
|
echo "authorized keys already there"
|
35 |
|
|
else
|
36 |
|
|
cat authorizedKeysToAppendToRootOfFussServer >> /root/.ssh/authorized_keys
|
37 |
|
|
fi
|
38 |
|
|
|
39 |
|
|
cp -r sshKeysForClonezillaClient $clonezillaFolder/.ssh
|
40 |
|
|
|
41 |
|
|
chown -R clonezilla. $clonezillaFolder/.ssh
|
42 |
|
|
|
43 |
|
|
chmod 400 $clonezillaFolder/.ssh/id_rsa*
|
44 |
|
|
|
45 |
|
|
cp -r clientScripts $clonezillaFolder
|
46 |
|
|
|
47 |
|
|
chmod -R 770 $clonezillaFolder/clientScripts
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
if [ -e $tftpFolder/pxelinux.cfg/default ];then
|
51 |
|
|
mv $tftpFolder/pxelinux.cfg/default $tftpFolder/pxelinux.cfg/default.BKP-$DATUM
|
52 |
|
|
fi
|
53 |
|
|
|
54 |
|
|
cp default $tftpFolder/pxelinux.cfg
|
55 |
|
|
|
56 |
|
|
if [ -e $clonezillaFolder/computerList.txt ];then
|
57 |
|
|
mv $clonezillaFolder/computerList.txt $clonezillaFolder/computerList.txt.BKP-$DATUM
|
58 |
|
|
fi
|
59 |
|
|
|
60 |
|
|
cp computerList.txt $clonezillaFolder
|
61 |
|
|
|
62 |
|
|
if [ -e $clonezillaFolder/script ];then
|
63 |
|
|
mv $clonezillaFolder/script $clonezillaFolder/script.BKP-$DATUM
|
64 |
|
|
fi
|
65 |
|
|
|
66 |
|
|
cp script $clonezillaFolder
|
67 |
|
|
|
68 |
|
|
chmod 770 $clonezillaFolder/script
|
69 |
|
|
|
70 |
|
|
chown -R clonezilla. $clonezillaFolder/*
|
71 |
|
|
|
72 |
|
|
exit 0
|