#!/bin/sh ############################################################################## # # # prerun.toram, (C) 2007-2010 S. Georgaras # # # # This file is part of Clonezilla-SysRescCD. # # # # Clonezilla-SysRescCD is free software: you can redistribute it and/or # # modify it under the terms of the GNU General Public License as published # # by the Free Software Foundation, either version 2 of the License, or # # (at your option) any later version. # # # # Clonezilla-SysRescCD is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License along # # with Clonezilla-SysRescCD. If not, see . # # # ############################################################################## if [ -e /root/.prerunExecuted ];then # This has to be executed only once exit fi touch /root/.prerunExecuted setterm -foreground yellow echo ' ##########################################' setterm -foreground white echo -n " Modifying .bashrc ... " echo >> /root/.bashrc echo "##########################################" >> /root/.bashrc echo "# aliases by Spiros" >> /root/.bashrc echo "##########################################" >> /root/.bashrc echo "# aliases..." >> /root/.bashrc echo "alias ls='ls --color'" >> /root/.bashrc echo "alias lf='ls -F --color'" >> /root/.bashrc echo "alias l='ls -la --color'" >> /root/.bashrc echo "##########################################" >> /root/.bashrc setterm -foreground green;echo 'done';setterm -foreground white echo -n " Trying to determine and mount your CD-ROM... " rm -rf /home/partimag 2>/dev/null mkdir /home/partimag # search all CDs 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}') do mount /dev/"$n" /home/partimag 2>/dev/null && { if [ -e /home/partimag/restorecd/ocswp.png ];then break else umount /home/partimag 2>/dev/null fi } done # search all partitions if [ -z "$(mount | grep /home/partimag)" ];then for n in $(cat /proc/partitions | grep [0-9]$ | sed 's|.* ||' | grep -v loop) do mount /dev/"$n" /home/partimag 2>/dev/null && { if [ -e /home/partimag/restorecd/ocswp.png ];then break else umount /home/partimag 2>/dev/null fi } done fi if [ -z "$(mount | grep /home/partimag)" ];then setterm -foreground magenta echo failed setterm -foreground white echo echo "Mounting the System Image has failed... You should boot" echo " Clonezilla Live to RAM for this to work!!!" echo "Press ENTER to restart..." read reboot exit 1 fi setterm -foreground green echo 'done' setterm -foreground white # # replace /home/partimag/restorecd with $restorecdFiles # echo -n " Copying new scripts... " for script in what-cd patch-clonezilla-sysresccd continue-multi-cd reloc-img imginfo imgconvert sbminst;do cp /home/partimag/restorecd/"$script" /usr/bin 2>/dev/null chmod +x /usr/bin/"$script" 2>/dev/null done cp /home/partimag/restorecd/ocs-iso /opt/drbl/sbin cp /home/partimag/restorecd/cust-menu /opt/drbl/sbin chmod +x /opt/drbl/sbin/ocs-iso chmod +x /opt/drbl/sbin/cust-menu # add cust-menu execution command to zip file creation script sed '/^cust-menu -z -publisher/d' /opt/drbl/sbin/ocs-live-dev | sed '/echo "Packing the output file $output_filename..."/i\ 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 chmod +x /opt/drbl/sbin/ocs-live-dev setterm -foreground green;echo 'done';setterm -foreground white setterm -foreground yellow echo '########################################## ' setterm -foreground white echo