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 |
setterm -foreground green;echo 'done';setterm -foreground white |
55 |
|
56 |
setterm -foreground yellow |
57 |
echo '########################################## |
58 |
' |
59 |
setterm -foreground white |
60 |
# |
61 |
# execute S09mountcd |
62 |
# |
63 |
# only when auto-restore and load to RAM |
64 |
# |
65 |
# |
66 |
echo |
67 |
echo -n "Trying to determine and mount your CD-ROM... " |
68 |
rm -rf /home/partimag 2>/dev/null |
69 |
mkdir /home/partimag |
70 |
|
71 |
# search all CDs |
72 |
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}') |
73 |
do |
74 |
mount /dev/"$n" /home/partimag 2>/dev/null && { |
75 |
if [ -e /home/partimag/restorecd/ocswp.png ];then |
76 |
break |
77 |
else |
78 |
umount /home/partimag 2>/dev/null |
79 |
fi |
80 |
} |
81 |
done |
82 |
|
83 |
# search all partitions |
84 |
if [ -z "$(mount | grep /home/partimag)" ];then |
85 |
for n in $(cat /proc/partitions | grep [0-9]$ | sed 's|.* ||' | grep -v loop) |
86 |
do |
87 |
mount /dev/"$n" /home/partimag 2>/dev/null && { |
88 |
if [ -e /home/partimag/restorecd/ocswp.png ];then |
89 |
break |
90 |
else |
91 |
umount /home/partimag 2>/dev/null |
92 |
fi |
93 |
} |
94 |
done |
95 |
fi |
96 |
|
97 |
if [ -z "$(mount | grep /home/partimag)" ];then |
98 |
setterm -foreground magenta |
99 |
echo failed |
100 |
setterm -foreground white |
101 |
echo |
102 |
echo "Mounting the System Image has failed... You should boot" |
103 |
echo " Clonezilla Live to RAM for this to work!!!" |
104 |
echo "Press ENTER to restart..." |
105 |
read |
106 |
reboot |
107 |
exit 1 |
108 |
fi |
109 |
|
110 |
setterm -foreground green |
111 |
echo 'done |
112 |
' |
113 |
setterm -foreground white |