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