1 |
|
2 |
#!/bin/sh |
3 |
############################################################################## |
4 |
# # |
5 |
# prerun.toram, (C) 2007-2010 S. Georgaras <sng@hellug.gr> # |
6 |
# # |
7 |
# This file is part of Clonezilla-SysRescCD. # |
8 |
# # |
9 |
# Clonezilla-SysRescCD is free software: you can redistribute it and/or # |
10 |
# modify it under the terms of the GNU General Public License as published # |
11 |
# by the Free Software Foundation, either version 2 of the License, or # |
12 |
# (at your option) any later version. # |
13 |
# # |
14 |
# Clonezilla-SysRescCD is distributed in the hope that it will be useful, # |
15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of # |
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
17 |
# GNU General Public License for more details. # |
18 |
# # |
19 |
# You should have received a copy of the GNU General Public License along # |
20 |
# with Clonezilla-SysRescCD. If not, see <http://www.gnu.org/licenses/>. # |
21 |
# # |
22 |
############################################################################## |
23 |
|
24 |
setterm -foreground yellow |
25 |
echo ' |
26 |
##########################################' |
27 |
setterm -foreground white |
28 |
echo -n " Modifying .bashrc ... " |
29 |
echo >> /root/.bashrc |
30 |
echo "##########################################" >> /root/.bashrc |
31 |
echo "# aliases by Spiros" >> /root/.bashrc |
32 |
echo "##########################################" >> /root/.bashrc |
33 |
echo "# aliases..." >> /root/.bashrc |
34 |
echo "alias ls='ls --color'" >> /root/.bashrc |
35 |
echo "alias lf='ls -F --color'" >> /root/.bashrc |
36 |
echo "alias l='ls -la --color'" >> /root/.bashrc |
37 |
echo "##########################################" >> /root/.bashrc |
38 |
setterm -foreground green;echo 'done';setterm -foreground white |
39 |
|
40 |
|
41 |
|
42 |
# |
43 |
# replace /live/image/restorecd with $restorecdFiles |
44 |
# |
45 |
echo -n " Copying new scripts... " |
46 |
for script in what-cd patch-clonezilla-sysresccd continue-multi-cd reloc-img imginfo imgconvert sbminst;do |
47 |
cp /live/image/restorecd/"$script" /usr/bin 2>/dev/null |
48 |
chmod +x /usr/bin/"$script" 2>/dev/null |
49 |
done |
50 |
cp /live/image/restorecd/ocs-iso /opt/drbl/sbin |
51 |
cp /live/image/restorecd/cust-menu /opt/drbl/sbin |
52 |
chmod +x opt/drbl/sbin/ocs-iso |
53 |
chmod +x opt/drbl/sbin/cust-menu |
54 |
# add cust-menu execution command to zip file creation script |
55 |
sed '/echo "Packing the output file $output_filename..."/i\ |
56 |
cust-menu -z -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" -z -V "$iso_label_tag" "$ORIGINAL_INSERT_MODE"' /opt/drbl/sbin/ocs-live-dev > /opt/drbl/sbin/ocs-live-dev.tmp && mv /opt/drbl/sbin/ocs-live-dev.tmp /opt/drbl/sbin/ocs-live-dev |
57 |
chmod +x /opt/drbl/sbin/ocs-live-dev |
58 |
setterm -foreground green;echo 'done';setterm -foreground white |
59 |
|
60 |
setterm -foreground yellow |
61 |
echo '########################################## |
62 |
' |
63 |
setterm -foreground white |
64 |
# |
65 |
# execute S09mountcd |
66 |
# |
67 |
# only when auto-restore and load to RAM |
68 |
# |
69 |
# |
70 |
echo |
71 |
echo -n "Trying to determine and mount your CD-ROM... " |
72 |
rm -rf /home/partimag 2>/dev/null |
73 |
mkdir /home/partimag |
74 |
|
75 |
# search all CDs |
76 |
for n in $(cat /proc/sys/dev/cdrom/info | grep 'drive name' |sed 's|drive name:[ \t]*||' | awk '{for(i=1;i<=NF;i++) print $i}') |
77 |
do |
78 |
mount /dev/"$n" /home/partimag 2>/dev/null && { |
79 |
if [ -e /home/partimag/restorecd/ocswp.png ];then |
80 |
break |
81 |
else |
82 |
umount /home/partimag 2>/dev/null |
83 |
fi |
84 |
} |
85 |
done |
86 |
|
87 |
# search all partitions |
88 |
if [ -z "$(mount | grep /home/partimag)" ];then |
89 |
for n in $(cat /proc/partitions | grep [0-9]$ | sed 's|.* ||' | grep -v loop) |
90 |
do |
91 |
mount /dev/"$n" /home/partimag 2>/dev/null && { |
92 |
if [ -e /home/partimag/restorecd/ocswp.png ];then |
93 |
break |
94 |
else |
95 |
umount /home/partimag 2>/dev/null |
96 |
fi |
97 |
} |
98 |
done |
99 |
fi |
100 |
|
101 |
if [ -z "$(mount | grep /home/partimag)" ];then |
102 |
setterm -foreground magenta |
103 |
echo failed |
104 |
setterm -foreground white |
105 |
echo |
106 |
echo "Mounting the System Image has failed... You should boot" |
107 |
echo " Clonezilla Live to RAM for this to work!!!" |
108 |
echo "Press ENTER to restart..." |
109 |
read |
110 |
reboot |
111 |
exit 1 |
112 |
fi |
113 |
|
114 |
setterm -foreground green |
115 |
echo 'done |
116 |
' |
117 |
setterm -foreground white |