/[clonezilla-sysresccd]/trunk/create-clonezilla-sysresccd/files/prerun.toram
ViewVC logotype

Contents of /trunk/create-clonezilla-sysresccd/files/prerun.toram

Parent Directory Parent Directory | Revision Log Revision Log


Revision 176 - (show annotations)
Tue May 31 19:45:21 2011 UTC (12 years, 10 months ago) by sng
File size: 4655 byte(s)
- updating prerun scripts. Making them run once
- updating ocs-iso to 1.2.8-46
- minor create-clonezilla-sysresccd update

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 if [ -e /root/.prerunExecuted ];then
24 # This has to be executed only once
25 exit
26 fi
27 touch /root/.prerunExecuted
28 setterm -foreground yellow
29 echo '
30 ##########################################'
31 setterm -foreground white
32 echo -n " Modifying .bashrc ... "
33 echo >> /root/.bashrc
34 echo "##########################################" >> /root/.bashrc
35 echo "# aliases by Spiros" >> /root/.bashrc
36 echo "##########################################" >> /root/.bashrc
37 echo "# aliases..." >> /root/.bashrc
38 echo "alias ls='ls --color'" >> /root/.bashrc
39 echo "alias lf='ls -F --color'" >> /root/.bashrc
40 echo "alias l='ls -la --color'" >> /root/.bashrc
41 echo "##########################################" >> /root/.bashrc
42 setterm -foreground green;echo 'done';setterm -foreground white
43
44
45
46 #
47 # replace /live/image/restorecd with $restorecdFiles
48 #
49 echo -n " Copying new scripts... "
50 for script in what-cd patch-clonezilla-sysresccd continue-multi-cd reloc-img imginfo imgconvert sbminst;do
51 cp /live/image/restorecd/"$script" /usr/bin 2>/dev/null
52 chmod +x /usr/bin/"$script" 2>/dev/null
53 done
54 cp /live/image/restorecd/ocs-iso /opt/drbl/sbin
55 cp /live/image/restorecd/cust-menu /opt/drbl/sbin
56 chmod +x opt/drbl/sbin/ocs-iso
57 chmod +x opt/drbl/sbin/cust-menu
58 # add cust-menu execution command to zip file creation script
59 sed '/^cust-menu -z -publisher/d' /opt/drbl/sbin/ocs-live-dev | sed '/echo "Packing the output file $output_filename..."/i\
60 cust-menu -z -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" -V "$iso_label_tag" "$ORIGINAL_INSERT_MODE"' > /opt/drbl/sbin/ocs-live-dev.tmp && mv /opt/drbl/sbin/ocs-live-dev.tmp /opt/drbl/sbin/ocs-live-dev
61 chmod +x /opt/drbl/sbin/ocs-live-dev
62 setterm -foreground green;echo 'done';setterm -foreground white
63
64 setterm -foreground yellow
65 echo '##########################################
66 '
67 setterm -foreground white
68 #
69 # execute S09mountcd
70 #
71 # only when auto-restore and load to RAM
72 #
73 #
74 echo
75 echo -n "Trying to determine and mount your CD-ROM... "
76 rm -rf /home/partimag 2>/dev/null
77 mkdir /home/partimag
78
79 # search all CDs
80 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}')
81 do
82 mount /dev/"$n" /home/partimag 2>/dev/null && {
83 if [ -e /home/partimag/restorecd/ocswp.png ];then
84 break
85 else
86 umount /home/partimag 2>/dev/null
87 fi
88 }
89 done
90
91 # search all partitions
92 if [ -z "$(mount | grep /home/partimag)" ];then
93 for n in $(cat /proc/partitions | grep [0-9]$ | sed 's|.* ||' | grep -v loop)
94 do
95 mount /dev/"$n" /home/partimag 2>/dev/null && {
96 if [ -e /home/partimag/restorecd/ocswp.png ];then
97 break
98 else
99 umount /home/partimag 2>/dev/null
100 fi
101 }
102 done
103 fi
104
105 if [ -z "$(mount | grep /home/partimag)" ];then
106 setterm -foreground magenta
107 echo failed
108 setterm -foreground white
109 echo
110 echo "Mounting the System Image has failed... You should boot"
111 echo " Clonezilla Live to RAM for this to work!!!"
112 echo "Press ENTER to restart..."
113 read
114 reboot
115 exit 1
116 fi
117
118 setterm -foreground green
119 echo 'done
120 '
121 setterm -foreground white

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26