/[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 191 - (show annotations)
Mon Aug 27 11:58:08 2012 UTC (8 years, 9 months ago) by sng
File size: 4623 byte(s)
Fixing prerun machanism
- Make clone.cfg use prerun.toram when loading to RAM
- Making prerun.toram mount the CD - apply customization -
  umount CD. This is the only way to do it!!! BUG FIXED
- Copying prerun.toram to prerun.toram-restore
  This script will be used when retoring from RAM - it
  will NOT umount the CD before exiting

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26