Advertisement
Guest User

Pinguybuilder

a guest
Jun 29th, 2016
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.28 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. . /etc/PinguyBuilder/PinguyBuilder.version
  4.  
  5. # checking to make sure script is running with root privileges
  6. if [ "$(whoami)" != "root" ]; then
  7. echo "Need to be root or run with sudo. Exiting."
  8. exit 1
  9. fi
  10.  
  11. #create PinguyBuilder-firstboot script if it doesn't exist and populate with at least removal of the ubiquity*.desktop file from users Desktop and fix for recovery mode
  12. fbtest=`grep "REM302" /etc/init.d/PinguyBuilder-firstboot`
  13.  
  14. if [ "$fbtest" = "" ]; then
  15. cat > /etc/init.d/PinguyBuilder-firstboot <<FOO
  16. #! /bin/sh
  17. ### BEGIN INIT INFO
  18. # Provides: PinguyBuilder-firstboot
  19. # Required-Start: \$remote_fs \$syslog \$all
  20. # Required-Stop:
  21. # Default-Start: 2 3 4 5
  22. # Default-Stop: 0 1 6
  23. # Short-Description: Run firstboot items for PinguyBuilder after a remastered system has been installed
  24. ### END INIT INFO
  25.  
  26. PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin
  27.  
  28. . /lib/init/vars.sh
  29. . /lib/lsb/init-functions
  30.  
  31. do_start() {
  32. #REM302
  33. if [ "\`cat /proc/cmdline | grep casper\`" = "" ]; then
  34. [ "\$VERBOSE" != no ] && log_begin_msg "Running PinguyBuilder-firstboot"
  35. (sleep 60 && update-rc.d -f PinguyBuilder-firstboot remove) &
  36. sed -i -e 's/root:x:/root:!:/g' /etc/shadow
  37. rm -rf /home/*/Desktop/ubiquity*.desktop
  38. rm -r /etc/apt
  39. tar -xf /root/apt.tar.gz -C /
  40. rm -rf /root/apt.tar.gz
  41. #Place your custom commands below this line
  42.  
  43. #Place your custom commands above this line
  44. ES=\$?
  45. [ "\$VERBOSE" != no ] && log_end_msg \$ES
  46. return \$ES
  47. fi
  48.  
  49.  
  50.  
  51.  
  52. }
  53.  
  54. case "\$1" in
  55. start)
  56. do_start
  57. ;;
  58. restart|reload|force-reload)
  59. echo "Error: argument '\$1' not supported" >&2
  60. exit 3
  61. ;;
  62. stop)
  63. ;;
  64. *)
  65. echo "Usage: \$0 start|stop" >&2
  66. exit 3
  67. ;;
  68. esac
  69.  
  70. FOO
  71.  
  72. fi
  73.  
  74.  
  75. # load the PinguyBuilder.conf file
  76. . /etc/PinguyBuilder.conf
  77.  
  78. # if the PinguyBuilder.conf file is incorrect or missing, make sure to set defaults
  79. echo "debug1"
  80.  
  81. if [ "$LIVEUSER" = "" ]; then
  82. #Somebody must have removed the username from the configuration file
  83. echo
  84. #this is a custom live user
  85. LIVEUSER="custom"
  86. fi
  87.  
  88. #make sure live user is all lowercase
  89. LIVEUSER="`echo $LIVEUSER | awk '{print tolower ($0)}'`"
  90.  
  91.  
  92. if [ "$WORKDIR" = "" ]; then
  93. BASEWORKDIR="/home/PinguyBuilder"
  94. WORKDIR="/home/PinguyBuilder/PinguyBuilder"
  95. else
  96. BASEWORKDIR="$WORKDIR"
  97. WORKDIR="$WORKDIR/PinguyBuilder"
  98. fi
  99.  
  100. if [ ! -d $WORKDIR ]; then
  101. mkdir -p $WORKDIR
  102. fi
  103.  
  104. if [ -f $WORKDIR/PinguyBuilder.log ]; then
  105. rm -f $WORKDIR/PinguyBuilder.log &> /dev/null
  106. fi
  107.  
  108. touch $WORKDIR/PinguyBuilder.log
  109.  
  110. #added log_msg to reduce size. code provided by Ivailo (a.k.a. SmiL3y)
  111. log_msg() {
  112. echo "$1"
  113. echo "$1" >>$WORKDIR/PinguyBuilder.log
  114. }
  115.  
  116. if [ "$LIVECDLABEL" = "" ]; then
  117. LIVECDLABEL="Custom Live CD"
  118. fi
  119.  
  120. CDBOOTTYPE="ISOLINUX"
  121.  
  122. if [ "$LIVECDURL" = "" ]; then
  123. LIVECDURL=""
  124. fi
  125.  
  126. if [ "$SQUASHFSOPTS" = "" ]; then
  127. SQUASHFSOPTS="-no-recovery -always-use-fragments -b 1M -no-duplicates -comp xz"
  128. fi
  129.  
  130. if [ "$BACKUPSHOWINSTALL" = "0" -o "$BACKUPSHOWINSTALL" = "1" ]; then
  131. echo
  132. else
  133. BACKUPSHOWINSTALL="1"
  134. fi
  135.  
  136. if [ "$2" = "cdfs" ]; then
  137. log_msg "Creating the cd filesystem only"
  138. elif [ "$2" = "iso" ]; then
  139. log_msg "Creating the iso file only"
  140. elif [ "$2" = "" ]; then
  141. echo " "
  142. else
  143. CUSTOMISO="$2"
  144. fi
  145.  
  146. if [ "$3" != "" ]; then
  147. CUSTOMISO="$3"
  148. fi
  149.  
  150. if [ "$CUSTOMISO" = "" ]; then
  151. CUSTOMISO="custom$1.iso"
  152. fi
  153.  
  154. case $1 in
  155.  
  156. backup)
  157. log_msg "System Backup Mode Selected"
  158. ;;
  159.  
  160. clean)
  161. echo "Removing the build directory now..."
  162. rm -rf $WORKDIR
  163. echo "Done...Exiting"
  164. exit 0
  165. ;;
  166.  
  167. dist)
  168. log_msg "Distribution Mode Selected"
  169. ;;
  170.  
  171.  
  172. *)
  173. echo "Usage of PinguyBuilder $PinguyBuilderVERSION is as follows:"
  174. echo " "
  175. echo " sudo PinguyBuilder backup|clean|dist [cdfs|iso] [filename.iso]"
  176. echo " "
  177. echo " "
  178. echo "Examples:"
  179. echo " "
  180. echo " sudo PinguyBuilder backup (to make a livecd/dvd backup of your system)"
  181. echo " "
  182. echo " sudo PinguyBuilder backup custom.iso"
  183. echo " (to make a livecd/dvd backup and call the iso custom.iso)"
  184. echo " "
  185. echo " sudo PinguyBuilder clean (to clean up temporary files of PinguyBuilder)"
  186. echo " "
  187. echo " sudo PinguyBuilder dist (to make a distributable livecd/dvd of your system)"
  188. echo " "
  189. echo " sudo PinguyBuilder dist cdfs"
  190. echo " (to make a distributable livecd/dvd filesystem only)"
  191. echo " "
  192. echo " sudo PinguyBuilder dist iso custom.iso"
  193. echo " (to make a distributable iso named custom.iso but only"
  194. echo " if the cdfs is already present)"
  195. echo " "
  196. echo " cdfs and iso options should only be used if you wish to modify something on the"
  197. echo " cd before the iso is created. An example of this would be to modify the isolinux"
  198. echo " portion of the livecd/dvd"
  199. echo " "
  200. exit 1
  201. ;;
  202.  
  203. esac
  204.  
  205. cdfs (){
  206. tar pczvf /root/apt.tar.gz /etc/apt &> /dev/null
  207. log_msg "Cleaning System before building"
  208. apt-get update &> /dev/null
  209. apt-get -y -q autoremove
  210. apt-get clean
  211. rm -rf /opt/teamviewer/config/global.conf
  212. dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs apt-get -y purge
  213.  
  214. log_msg "Enabling PinguyBuilder-firstboot"
  215. chmod 755 /etc/init.d/PinguyBuilder-firstboot
  216. update-rc.d PinguyBuilder-firstboot defaults
  217.  
  218. log_msg "Checking filesystem type of the Working Folder"
  219. DIRTYPE=`df -T -P $WORKDIR | grep "^\/dev" | awk '{print $2}'`
  220. log_msg "$WORKDIR is on a $DIRTYPE filesystem"
  221.  
  222. #removing popularity-contest as it causes a problem when installing with ubiquity
  223. log_msg "Making sure popularity contest is not installed"
  224. apt-get -y -q remove popularity-contest &> /dev/null
  225.  
  226. #removing syslinux-themes as it causes problems
  227. log_msg "Making sure syslinux-themes is not installed"
  228. apt-get -y -q purge syslinux-themes* &> /dev/null
  229.  
  230. #Installing isolinux if needed
  231. log_msg "Making sure isolinux is installed"
  232. apt-get -y -q install isolinux syslinux-utils &> /dev/null
  233.  
  234. # check whether system is gnome or kde based to load the correct ubiquity frontend
  235.  
  236. if [ "`ps axf | grep startkde | grep -v grep`" != "" -o "`ps axf | grep kwin | grep -v grep`" != "" ]; then
  237. log_msg "Installing the Ubiquity KDE frontend"
  238. apt-get -y -q install ubiquity-frontend-kde &> /dev/null
  239. apt-get -y -q remove ubiquity-frontend-gtk &> /dev/null
  240. sed -i "s/sh -c/sudo sh -c/" /usr/share/applications/kde4/ubiquity-kdeui.desktop &> /dev/null
  241. else
  242. log_msg "Installing the Ubiquity GTK frontend"
  243. apt-get -y -q install ubiquity-frontend-gtk &> /dev/null
  244. apt-get -y -q remove ubiquity-frontend-kde &> /dev/null
  245. sed -i "s/sh -c/sudo sh -c/" /usr/share/applications/ubiquity.desktop &> /dev/null
  246. fi
  247.  
  248. # Check if they are using lightdm and if it is setup properly for the live default session
  249. # [ "`grep lightdm /etc/X11/default-display-manager`" != "" ] && [ ! -f /etc/lightdm/lightdm.conf ] && [ ! -f /usr/share/xsessions/ubuntu.desktop ] && echo "Lightdm not setup properly. You must set your default desktop with lightdm prior to remastering" && echo "Lightdm not setup properly. You must set your default desktop with lightdm prior to remastering" >> $WORKDIR/PinguyBuilder.log && exit 1
  250.  
  251. # prevent the installer from changing the apt sources.list
  252.  
  253. sed -i '/rm/d' /usr/share/ubiquity/apt-setup
  254. sed -i '/boot/d' /usr/share/ubiquity/apt-setup
  255. sed -i '/cdrom:/d' /usr/share/ubiquity/apt-setup
  256. echo "mkdir -p /target/boot/efi" >> /usr/share/ubiquity/apt-setup
  257. echo "rm -f /target/boot/efi/startup.nsh" >> /usr/share/ubiquity/apt-setup
  258. echo "touch /target/boot/efi/startup.nsh" >> /usr/share/ubiquity/apt-setup
  259. ARCH=`archdetect | awk -F "/" '{print $1}'`
  260. if [ "$ARCH" = "amd64" ] ; then
  261. echo 'echo "fs0:\EFI\ubuntu\grubx64.efi" >> /target/boot/efi/startup.nsh' >> /usr/share/ubiquity/apt-setup
  262. else
  263. echo 'echo "fs0:\EFI\custom\grubia32.efi" >> /target/boot/efi/startup.nsh' >> /usr/share/ubiquity/apt-setup
  264. fi
  265. echo "rm -f /target/etc/gdm/custom.conf" >> /usr/share/ubiquity/apt-setup
  266. echo "rm -f /target/etc/mdm/mdm.conf" >> /usr/share/ubiquity/apt-setup
  267.  
  268. sleep 1
  269.  
  270. # Step 3 - Create the CD tree in $WORKDIR/ISOTMP
  271. log_msg "Checking if the $WORKDIR folder has been created"
  272. if [ -d "$WORKDIR/dummysys" ]; then
  273. rm -rf $WORKDIR/dummysys/var/*
  274. rm -rf $WORKDIR/dummysys/etc/*
  275. rm -rf $WORKDIR/dummysys/run/*
  276. rm -rf $WORKDIR/ISOTMP/{isolinux,grub,.disk}
  277. else
  278. log_msg "Creating $WORKDIR folder tree"
  279. mkdir -p $WORKDIR/ISOTMP/{casper,preseed}
  280. mkdir -p $WORKDIR/dummysys/{dev,etc,proc,tmp,sys,mnt,media/cdrom,var}
  281. rsync -a /dev/urandom $WORKDIR/dummysys/dev/
  282. if [ -d /run ]; then
  283. mkdir -p $WORKDIR/dummysys/run
  284. fi
  285. chmod ug+rwx,o+rwt $WORKDIR/dummysys/tmp
  286.  
  287. fi
  288.  
  289. log_msg "Creating $WORKDIR/ISOTMP folder tree"
  290. mkdir -p $WORKDIR/ISOTMP/{isolinux,install,.disk}
  291.  
  292. log_msg "Copying /var and /etc to temp area and excluding extra files ... this will take a while so be patient"
  293.  
  294. if [ "$EXCLUDES" != "" ]; then
  295. for addvar in $EXCLUDES ; do
  296. VAREXCLUDES="$VAREXCLUDES --exclude='$addvar' "
  297. done
  298. fi
  299.  
  300. rsync --exclude='*.log.*' --exclude='*~' --exclude='*.pid' --exclude='*.bak' --exclude='*.[0-9].gz' --exclude='*.deb' --exclude='kdecache*' $VAREXCLUDES-a /var/. $WORKDIR/dummysys/var/.
  301. rsync $VAREXCLUDES-a /etc/. $WORKDIR/dummysys/etc/.
  302.  
  303. #Adding packages location to sources
  304. ARCH=`archdetect | awk -F "/" '{print $1}'`
  305. DISKINFONAME=`echo $LIVECDLABEL | awk '{print $1}'`
  306. log_msg "Adding CD-ROM to source list"
  307. . /etc/lsb-release
  308. sed -i '/cdrom:/d' $WORKDIR/dummysys/etc/apt/sources.list &> /dev/null
  309. echo "deb cdrom:[$DISKINFONAME $DISTRIB_RELEASE - Release $ARCH]/ dists/" >> $WORKDIR/dummysys/etc/apt/sources.list
  310. echo "debug cdfs1"
  311. #Copying grub config
  312. cp /etc/PinguyBuilder/grub.ucf-dist $WORKDIR/dummysys/etc/default/grub
  313. sed -i "s/LIVECDLABEL/$LIVECDLABEL/g" $WORKDIR/dummysys/etc/default/grub
  314.  
  315. log_msg "Cleaning up files not needed for the live in $WORKDIR/dummysys"
  316. rm -rf $WORKDIR/dummysys/etc/apt/sources.list.d/*.save &> /dev/null
  317. rm -rf $WORKDIR/dummysys/etc/apt/apt.conf.d/* &> /dev/null
  318. rm -rf $WORKDIR/dummysys/etc/apt/preferences.d/* &> /dev/null
  319. rm -rf $WORKDIR/dummysys/var/lib/apt/lists/* -vf &> /dev/null
  320. rm -rf $WORKDIR/dummysys/var/lib/apt/lists/lock &> /dev/null
  321. rm -rf $WORKDIR/dummysys/var/cache/apt/archives/* &> /dev/null
  322. rm -rf $WORKDIR/dummysys/var/lib/ureadahead/pack &> /dev/null
  323. rm -f $WORKDIR/dummysys/etc/X11/xorg.conf*
  324. rm -f $WORKDIR/dummysys/etc/{hosts,hostname,mtab*,fstab}
  325. if [ ! -L $WORKDIR/dummysys/etc/resolv.conf ]; then
  326. rm -f $WORKDIR/dummysys/etc/resolv.conf
  327. fi
  328. rm -f $WORKDIR/dummysys/etc/udev/rules.d/70-persistent*
  329. rm -f $WORKDIR/dummysys/etc/cups/ssl/{server.crt,server.key}
  330. rm -f $WORKDIR/dummysys/etc/ssh/*key*
  331. rm -f $WORKDIR/dummysys/var/lib/dbus/machine-id
  332. rsync -a /dev/urandom $WORKDIR/dummysys/dev/
  333. find $WORKDIR/dummysys/var/log/ $WORKDIR/dummysys/var/lock/ $WORKDIR/dummysys/var/backups/ $WORKDIR/dummysys/var/tmp/ $WORKDIR/dummysys/var/crash/ $WORKDIR/dummysys/var/lib/ubiquity/ -type f -exec rm -f {} \;
  334.  
  335. if [ "$1" = "dist" ]; then
  336.  
  337. rm -f $WORKDIR/dummysys/etc/{group,passwd,shadow,shadow-,gshadow,gshadow-}
  338. rm -f $WORKDIR/dummysys/etc/wicd/{wired-settings.conf,wireless-settings.conf}
  339. rm -rf $WORKDIR/dummysys/etc/NetworkManager/system-connections/*
  340. rm -f $WORKDIR/dummysys/etc/printcap
  341. rm -f $WORKDIR/dummysys/etc/cups/printers.conf
  342. touch $WORKDIR/dummysys/etc/printcap
  343. touch $WORKDIR/dummysys/etc/cups/printers.conf
  344. rm -rf $WORKDIR/dummysys/var/cache/gdm/*
  345. rm -rf $WORKDIR/dummysys/var/lib/sudo/*
  346. rm -rf $WORKDIR/dummysys/var/lib/AccountsService/users/*
  347. rm -rf $WORKDIR/dummysys/var/lib/kdm/*
  348. rm -rf $WORKDIR/dummysys/var/run/console/*
  349. rm -f $WORKDIR/dummysys/etc/gdm/gdm.conf-custom
  350. #Setting up auto timed login for GDM3
  351. cp -a /etc/PinguyBuilder/gdm $WORKDIR/dummysys/etc/
  352. sed -i "s/LIVEUSER/$LIVEUSER/g" $WORKDIR/dummysys/etc/gdm/custom.conf
  353. chmod +x $WORKDIR/dummysys/etc/gdm/custom.conf
  354. chmod 755 $WORKDIR/dummysys/etc/gdm/custom.conf
  355. #Setting up auto timed login for MDM
  356. cp -a /etc/PinguyBuilder/mdm $WORKDIR/dummysys/etc/
  357. sed -i "s/LIVEUSER/$LIVEUSER/g" $WORKDIR/dummysys/etc/mdm/mdm.conf
  358. chmod +x $WORKDIR/dummysys/etc/mdm/mdm.conf
  359. chmod 755 $WORKDIR/dummysys/etc/mdm/mdm.conf
  360. echo "debug cdfs2"
  361. if [ ! -d /run ]; then
  362. find $WORKDIR/dummysys/var/run/ $WORKDIR/dummysys/var/mail/ $WORKDIR/dummysys/var/spool/ -type f -exec rm -f {} \;
  363. else
  364. find $WORKDIR/dummysys/var/mail/ $WORKDIR/dummysys/var/spool/ -type f -exec rm -f {} \;
  365. unlink $WORKDIR/dummysys/var/run
  366. cd $WORKDIR/dummysys/var
  367. ln -sf ../run run
  368. fi
  369. for i in dpkg.log lastlog mail.log syslog auth.log daemon.log faillog lpr.log mail.warn user.log boot debug mail.err messages wtmp bootstrap.log dmesg kern.log mail.info
  370. do
  371. touch $WORKDIR/dummysys/var/log/${i}
  372. done
  373. log_msg "Cleaning up passwd, group, shadow and gshadow files for the live system"
  374. grep '^[^:]*:[^:]*:[0-9]:' /etc/passwd > $WORKDIR/dummysys/etc/passwd
  375. grep '^[^:]*:[^:]*:[0-9][0-9]:' /etc/passwd >> $WORKDIR/dummysys/etc/passwd
  376. grep '^[^:]*:[^:]*:[0-9][0-9][0-9]:' /etc/passwd >> $WORKDIR/dummysys/etc/passwd
  377. grep '^[^:]*:[^:]*:[3-9][0-9][0-9][0-9][0-9]:' /etc/passwd >> $WORKDIR/dummysys/etc/passwd
  378.  
  379. grep '^[^:]*:[^:]*:[0-9]:' /etc/group > $WORKDIR/dummysys/etc/group
  380. grep '^[^:]*:[^:]*:[0-9][0-9]:' /etc/group >> $WORKDIR/dummysys/etc/group
  381. grep '^[^:]*:[^:]*:[0-9][0-9][0-9]:' /etc/group >> $WORKDIR/dummysys/etc/group
  382. grep '^[^:]*:[^:]*:[3-9][0-9][0-9][0-9][0-9]:' /etc/group >> $WORKDIR/dummysys/etc/group
  383.  
  384. grep '^[^:]*:[^:]*:[5-9][0-9][0-9]:' /etc/passwd | awk -F ":" '{print $1}'> $WORKDIR/tmpusers1
  385. grep '^[^:]*:[^:]*:[1-9][0-9][0-9][0-9]:' /etc/passwd | awk -F ":" '{print $1}'> $WORKDIR/tmpusers2
  386. grep '^[^:]*:[^:]*:[1-2][0-9][0-9][0-9][0-9]:' /etc/passwd | awk -F ":" '{print $1}'> $WORKDIR/tmpusers3
  387.  
  388. cat $WORKDIR/tmpusers1 $WORKDIR/tmpusers2 $WORKDIR/tmpusers3 > $WORKDIR/tmpusers
  389. rm -f $WORKDIR/tmpusers[0-9] &> /dev/null
  390.  
  391. #cp /etc/shadow $WORKDIR/dummysys/etc/shadow
  392. #cp /etc/gshadow $WORKDIR/dummysys/etc/gshadow
  393.  
  394. cat $WORKDIR/tmpusers | while read LINE ;do
  395.  
  396. echo $LINE | xargs -i sed -e 's/,{}$//g' $WORKDIR/dummysys/etc/group > $WORKDIR/dummysys/etc/group.new1
  397. echo $LINE | xargs -i sed -e 's/,{},/,/g' $WORKDIR/dummysys/etc/group.new1 > $WORKDIR/dummysys/etc/group.new2
  398. echo $LINE | xargs -i sed -e 's/:{}$/:/g' $WORKDIR/dummysys/etc/group.new2 > $WORKDIR/dummysys/etc/group.new3
  399. echo $LINE | xargs -i sed -e 's/:{},/:/g' $WORKDIR/dummysys/etc/group.new3 > $WORKDIR/dummysys/etc/group
  400.  
  401. # /etc/shadow and /etc/gshadow needed for rescue mode boot root access - removed due to user creation issues for live boot
  402.  
  403. # echo $LINE | xargs -i sed -e '/^{}:/d' $WORKDIR/dummysys/etc/shadow > $WORKDIR/dummysys/etc/shadow.new
  404. #sed -i -e 's/root:x:/root:!:/g' $WORKDIR/dummysys/etc/shadow.new
  405. #mv $WORKDIR/dummysys/etc/shadow.new $WORKDIR/dummysys/etc/shadow
  406.  
  407. #echo $LINE | xargs -i sed -e '/^{}:/d' $WORKDIR/dummysys/etc/gshadow > $WORKDIR/dummysys/etc/gshadow.new1
  408. #echo $LINE | xargs -i sed -e 's/,{}$//g' $WORKDIR/dummysys/etc/gshadow.new1 > $WORKDIR/dummysys/etc/gshadow.new2
  409. #echo $LINE | xargs -i sed -e 's/,{},/,/g' $WORKDIR/dummysys/etc/gshadow.new2 > $WORKDIR/dummysys/etc/gshadow.new3
  410. #echo $LINE | xargs -i sed -e 's/:{}$/:/g' $WORKDIR/dummysys/etc/gshadow.new3 > $WORKDIR/dummysys/etc/gshadow.new4
  411. #echo $LINE | xargs -i sed -e 's/:{},/:/g' $WORKDIR/dummysys/etc/gshadow.new4 > $WORKDIR/dummysys/etc/gshadow
  412.  
  413. rm -f $WORKDIR/dummysys/etc/group.new* &> /dev/null
  414.  
  415. done
  416.  
  417. fi
  418.  
  419.  
  420. # make sure the adduser and autologin functions of casper as set according to the mode
  421. log_msg "Making sure adduser and autologin functions of casper are set properly"
  422. [ "$1" = "dist" ] && [ ! -d $WORKDIR/dummysys/home ] && mkdir $WORKDIR/dummysys/home
  423. [ "$1" = "dist" ] && chmod 755 /usr/share/initramfs-tools/scripts/casper-bottom/*adduser /usr/share/initramfs-tools/scripts/casper-bottom/*autologin
  424. [ "$1" = "backup" ] && [ -d $WORKDIR/dummysys/home ] && rm -rf $WORKDIR/dummysys/home
  425. [ "$1" = "backup" ] && chmod 644 /usr/share/initramfs-tools/scripts/casper-bottom/*adduser /usr/share/initramfs-tools/scripts/casper-bottom/*autologin
  426.  
  427. # copy over some of the necessary stuff for the livecd
  428.  
  429. #copy any preseed files
  430. cp /etc/PinguyBuilder/preseed/* $WORKDIR/ISOTMP/preseed/
  431. echo "debug cdfs3"
  432. #BOOT Type is isolinux
  433. log_msg "Copying memtest86+ for the live system"
  434. cp /boot/memtest86+.bin $WORKDIR/ISOTMP/install/memtest
  435.  
  436. #EFI BOOT
  437. log_msg "Copying EFI Boot for the live system"
  438. cp -a /usr/lib/PinguyBuilder/boot $WORKDIR/ISOTMP/
  439. cp -a /usr/lib/PinguyBuilder/EFI $WORKDIR/ISOTMP/
  440. #cp $WORKDIR/ISOTMP/EFI/BOOT/BOOTx64.EFI $WORKDIR/ISOTMP/EFI/BOOT/fallback.efi
  441. sed -i "s/__LIVECDLABEL__/$LIVECDLABEL/g" $WORKDIR/ISOTMP/boot/grub/grub.cfg
  442. sed -i "s/__LIVECDLABEL__/$LIVECDLABEL/g" $WORKDIR/ISOTMP/boot/grub/loopback.cfg
  443.  
  444. #Downloading packages for offline install
  445. log_msg "Downloading packages for CD"
  446.  
  447. # Check Architecture
  448. ARCH=`archdetect | awk -F "/" '{print $1}'`
  449.  
  450. mkdir -p $WORKDIR/ISOTMP/pool
  451. cd $WORKDIR/ISOTMP/pool
  452. if [ "$ARCH" = "amd64" ] ; then
  453. apt-get download b43-fwcutter bcmwl-kernel-source efibootmgr grub-common grub-efi grub-efi-amd64 grub-efi-amd64-bin grub-efi-amd64-signed grub-efi-ia32 grub-efi-ia32-bin grub-pc-bin grub-pc grub2-common grub-gfxpayload-lists libefivar0 mokutil secureboot-db shim shim-signed &> /dev/null
  454. else
  455. apt-get download b43-fwcutter bcmwl-kernel-source efibootmgr grub-common grub-efi grub-efi-ia32 grub-efi-ia32-bin grub-pc-bin grub-pc grub2-common grub-gfxpayload-lists libefivar0 mokutil secureboot-db &> /dev/null
  456. fi
  457. mkdir -p $WORKDIR/ISOTMP/dists
  458. cd $WORKDIR/ISOTMP/
  459. dpkg-scanpackages pool /dev/null | gzip -9c > dists/Packages.gz
  460.  
  461. # check and see if they have a custom isolinux already setup. eg. they copied over
  462. # the isolinux folder from their original livecd or made a custom one for their distro
  463.  
  464. if [ ! -f /etc/PinguyBuilder/customisolinux/isolinux.cfg ]; then
  465. log_msg "Creating isolinux setup for the live system"
  466. find /usr -name 'isolinux.bin' -exec cp {} $WORKDIR/ISOTMP/isolinux/ \;
  467. #find fix for vesamenu.32 provided by Krasimir S. Stefanov <lokiisyourmaster@gmail.com>
  468. VESAMENU=`find /usr -print0 | grep -FzZ "bios/vesamenu.c32"`
  469. cp $VESAMENU $WORKDIR/ISOTMP/isolinux/
  470. LDLINUX=`find /usr -print0 | grep -FzZ "bios/ldlinux.c32"`
  471. cp $LDLINUX $WORKDIR/ISOTMP/isolinux/
  472. LIBUTIL=`find /usr -print0 | grep -FzZ "bios/libutil.c32"`
  473. cp $LIBUTIL $WORKDIR/ISOTMP/isolinux/
  474. LIBCOM=`find /usr -print0 | grep -FzZ "bios/libcom32.c32"`
  475. cp $LIBCOM $WORKDIR/ISOTMP/isolinux/
  476. MENU=`find /usr -print0 | grep -FzZ "bios/menu.c32"`
  477. cp $MENU $WORKDIR/ISOTMP/isolinux/
  478. # setup isolinux for the livecd
  479. VERSION=`lsb_release -r | awk '{print $2}' | awk -F "." '{print $1}'`
  480. sed -e 's/__LIVECDLABEL__/'"$LIVECDLABEL"'/g' /etc/PinguyBuilder/isolinux/isolinux.cfg.vesamenu > \
  481. $WORKDIR/ISOTMP/isolinux/isolinux.cfg
  482. cp /etc/PinguyBuilder/isolinux/splash.png $WORKDIR/ISOTMP/isolinux/splash.png
  483. else
  484. log_msg "Copying your custom isolinux setup to the live system"
  485. cp /etc/PinguyBuilder/customisolinux/* $WORKDIR/ISOTMP/isolinux/ &> /dev/null
  486.  
  487. fi
  488. echo "debug cdfs 4"
  489. log_msg "Checking the ARCH of the system and setting the README.diskdefines file"
  490. ARCH=`archdetect | awk -F "/" '{print $1}'`
  491. cat > $WORKDIR/ISOTMP/README.diskdefines <<FOO
  492. #define DISKNAME $LIVECDLABEL
  493. #define TYPE binary
  494. #define TYPEbinary 1
  495. #define ARCH $ARCH
  496. #define ARCH$ARCH 1
  497. #define DISKNUM 1
  498. #define DISKNUM1 1
  499. #define TOTALNUM 0
  500. #define TOTALNUM0 1
  501. FOO
  502. cp $WORKDIR/ISOTMP/README.diskdefines $WORKDIR/ISOTMP/casper/README.diskdefines
  503.  
  504. sleep 1
  505.  
  506. # Step 4 - Make the filesystem.manifest and filesystem.manifest-desktop
  507. log_msg "Creating filesystem.manifest and filesystem.manifest-desktop"
  508. dpkg-query -W --showformat='${Package} ${Version}\n' > $WORKDIR/ISOTMP/casper/filesystem.manifest
  509.  
  510. cp $WORKDIR/ISOTMP/casper/filesystem.manifest $WORKDIR/ISOTMP/casper/filesystem.manifest-desktop
  511. # Suggested by lkjoel from Ubuntu Forums - Joel Leclerc to remove the frontend so the Install menu item is not on the installed system
  512. sed -i '/ubiquity-frontend/d' $WORKDIR/ISOTMP/casper/filesystem.manifest-desktop
  513.  
  514. sleep 1
  515.  
  516. # Step 5 - Prepare casper.conf depending on whether this is a backup or dist
  517.  
  518. if [ "$1" = "backup" ]; then
  519. BACKUPEXCLUDES=""
  520. log_msg "Excluding folder from the backup that will cause issues"
  521.  
  522. for bi in `ls /home`; do
  523. if [ -d /home/$bi/.gvfs ]; then
  524. BACKUPEXCLUDES="$BACKUPEXCLUDES /home/$bi/.gvfs "
  525. fi
  526. if [ -d /home/$bi/.cache ]; then
  527. BACKUPEXCLUDES="$BACKUPEXCLUDES /home/$bi/.cache "
  528. fi
  529. if [ -d /home/$bi/.thumbnails ]; then
  530. BACKUPEXCLUDES="$BACKUPEXCLUDES /home/$bi/.thumbnails "
  531. fi
  532. if [ -d /home/$bi/.local/share/gvfs-metadata ]; then
  533. BACKUPEXCLUDES="$BACKUPEXCLUDES /home/$bi/.local/share/gvfs-metadata "
  534. fi
  535. if [ -d /home/$bi/.local/gvfs-metadata ]; then
  536. BACKUPEXCLUDES="$BACKUPEXCLUDES /home/$bi/.local/gvfs-metadata "
  537. fi
  538. if [ -d /home/$bi/.local/share/Trash ]; then
  539. BACKUPEXCLUDES="$BACKUPEXCLUDES /home/$bi/.local/share/Trash "
  540. fi
  541. done
  542. LIVEUSER="`who -u | grep -v root | cut -d " " -f1| uniq`"
  543. if [ "`who -u | grep -v root | cut -d " " -f1| uniq | wc -l`" != "1" ]; then
  544. LIVEUSER="`grep '^[^:]*:[^:]*:1000:' /etc/passwd | awk -F ":" '{ print $1 }'`"
  545. fi
  546. if [ "$LIVEUSER" = "" ]; then
  547. log_msg "Can't determine which user to use. Please logoff all users except for your main user and try again. Exiting."
  548. exit 1
  549. fi
  550. LIVEHOME=`grep $LIVEUSER /etc/passwd | awk -F ":" '{print $6}'`
  551. if [ "$BACKUPSHOWINSTALL" = "1" ]; then
  552. # copy the install icon to the sudo users desktop
  553. log_msg "Copying the install icon to the desktop of $LIVEUSER"
  554. UBIQUITYDESKTOP=`find /usr -name ubiquity*.desktop`
  555. install -d -o $LIVEUSER -g $LIVEUSER /$LIVEHOME/Desktop &> /dev/null
  556. install -D -o $LIVEUSER -g $LIVEUSER $UBIQUITYDESKTOP /$LIVEHOME/Desktop/ &> /dev/null
  557. sed -i "s/RELEASE/$LIVECDLABEL/" "/$LIVEHOME/Desktop/`basename $UBIQUITYDESKTOP`" &> /dev/null
  558. fi
  559.  
  560. fi
  561. log_msg "Creating the casper.conf file."
  562. # Added FLAVOUR= as the new casper live boot will make it the first word from the Live CD Name if FLAVOUR is not set
  563. cat > /etc/casper.conf <<FOO
  564. # This file should go in /etc/casper.conf
  565. # Supported variables are:
  566. # USERNAME, USERFULLNAME, HOST, BUILD_SYSTEM
  567.  
  568. export USERNAME="$LIVEUSER"
  569. export USERFULLNAME="Live session user"
  570. export HOST="$LIVEUSER"
  571. export BUILD_SYSTEM="Ubuntu"
  572. export FLAVOUR="$LIVEUSER"
  573. FOO
  574. cp /etc/casper.conf $WORKDIR/dummysys/etc/
  575.  
  576. sleep 1
  577.  
  578.  
  579. # if the mode is dist then renumber the uid's for any user with a uid greater than 1000
  580. # and make the passwdrestore file so the uid's are restored before the script finishes
  581. # if this is not done, the livecd user will not be created properly
  582. log_msg "Checking and setting user-setup-apply for the live system"
  583. if [ "$1" = "dist" ]; then
  584.  
  585. # make sure user-setup-apply is present in case backup mode was last used
  586.  
  587. if [ -f /usr/lib/ubiquity/user-setup/user-setup-apply.orig ]; then
  588. cp /usr/lib/ubiquity/user-setup/user-setup-apply.orig /usr/lib/ubiquity/user-setup/user-setup-apply
  589. fi
  590.  
  591. else
  592.  
  593. # since this is backup mode, prevent user-setup-apply from running during install
  594. if [ ! -f /usr/lib/ubiquity/user-setup/user-setup-apply.orig ]; then
  595. mv /usr/lib/ubiquity/user-setup/user-setup-apply /usr/lib/ubiquity/user-setup/user-setup-apply.orig
  596. fi
  597. echo "exit 0"> /usr/lib/ubiquity/user-setup/user-setup-apply
  598. chmod 755 /usr/lib/ubiquity/user-setup/user-setup-apply
  599.  
  600. fi
  601.  
  602. echo "debug cdfs6"
  603. sleep 1
  604.  
  605. log_msg "Setting up casper and ubiquity options for $1 mode"
  606.  
  607. # make a new initial ramdisk including the casper scripts
  608. log_msg "Creating a new initial ramdisk for the live system"
  609. mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`
  610.  
  611. log_msg "Copying your kernel and initrd for the livecd"
  612. cp /boot/vmlinuz-`uname -r` $WORKDIR/ISOTMP/casper/vmlinuz
  613. cp /boot/initrd.img-`uname -r` $WORKDIR/ISOTMP/casper/initrd.gz
  614. if [ ! -f $WORKDIR/ISOTMP/casper/vmlinuz ]; then
  615. log_msg "Missing valid kernel. Exiting"
  616. exit 1
  617. fi
  618. if [ ! -f $WORKDIR/ISOTMP/casper/initrd.gz ]; then
  619. log_msg "Missing valid initial ramdisk. Exiting"
  620. exit 1
  621. fi
  622.  
  623. # Step 6 - Make filesystem.squashfs
  624.  
  625. if [ -f $WORKDIR/ISOTMP/casper/filesystem.squashfs ]; then
  626. rm -f $WORKDIR/ISOTMP/casper/filesystem.squashfs &> /dev/null
  627. fi
  628.  
  629. log_msg "Creating filesystem.squashfs ... this will take a while so be patient"
  630.  
  631. REALFOLDERS=""
  632.  
  633. for d in `ls -d $WORKDIR/dummysys/*`; do
  634. REALFOLDERS="$REALFOLDERS $d"
  635. done
  636.  
  637. if [ "$1" = "backup" ]; then
  638.  
  639. for d in `ls / | grep -v etc | grep -v run | grep -v tmp | grep -v sys | grep -v var | grep -v dev | grep -v media | grep -v mnt | grep -v lost+found | grep -v proc`; do
  640. REALFOLDERS="$REALFOLDERS /$d"
  641. done
  642.  
  643. else
  644.  
  645. for d in `ls / | grep -v etc | grep -v run | grep -v tmp | grep -v sys | grep -v var | grep -v dev | grep -v media | grep -v mnt | grep -v lost+found | grep -v proc | grep -v home`; do
  646. REALFOLDERS="$REALFOLDERS /$d"
  647. done
  648.  
  649. fi
  650.  
  651. mksquashfs $REALFOLDERS $WORKDIR/ISOTMP/casper/filesystem.squashfs -no-duplicates $SQUASHFSOPTS -e /boot/efi/EFI /boot/grub $BASEWORKDIR $EXCLUDES 2>>$WORKDIR/PinguyBuilder.log
  652. echo"debug cdfs 7"
  653.  
  654. sleep 1
  655.  
  656. #add some stuff the log in case of problems so I can troubleshoot it easier
  657. echo "Updating the PinguyBuilder.log"
  658. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  659. echo "Mount information" >>$WORKDIR/PinguyBuilder.log
  660. mount >>$WORKDIR/PinguyBuilder.log
  661. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  662. echo "Disk size information" >>$WORKDIR/PinguyBuilder.log
  663. df -h >>$WORKDIR/PinguyBuilder.log
  664. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  665. echo "Casper Script info" >>$WORKDIR/PinguyBuilder.log
  666. ls -l /usr/share/initramfs-tools/scripts/casper-bottom/ >>$WORKDIR/PinguyBuilder.log
  667. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  668. echo "/etc/PinguyBuilder.conf info" >>$WORKDIR/PinguyBuilder.log
  669. cat /etc/PinguyBuilder.conf >>$WORKDIR/PinguyBuilder.log
  670. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  671. echo "/etc/casper.conf info" >>$WORKDIR/PinguyBuilder.log
  672. cat /etc/casper.conf >>$WORKDIR/PinguyBuilder.log
  673. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  674. echo "/etc/passwd info" >>$WORKDIR/PinguyBuilder.log
  675. cat $WORKDIR/dummysys/etc/passwd >>$WORKDIR/PinguyBuilder.log
  676. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  677. echo "/etc/group info" >>$WORKDIR/PinguyBuilder.log
  678. cat $WORKDIR/dummysys/etc/group >>$WORKDIR/PinguyBuilder.log
  679. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  680. echo "/etc/X11/default-display-manager info" >>$WORKDIR/PinguyBuilder.log
  681. cat $WORKDIR/dummysys/etc/X11/default-display-manager >>$WORKDIR/PinguyBuilder.log
  682. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  683. echo "/etc/skel info" >>$WORKDIR/PinguyBuilder.log
  684. find /etc/skel >>$WORKDIR/PinguyBuilder.log
  685. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  686. echo "lsb-release info" >>$WORKDIR/PinguyBuilder.log
  687. cat $WORKDIR/dummysys/etc/lsb-release >>$WORKDIR/PinguyBuilder.log
  688. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  689. echo "PinguyBuilder version info" >>$WORKDIR/PinguyBuilder.log
  690. cat $WORKDIR/dummysys/etc/PinguyBuilder/PinguyBuilder.version >>$WORKDIR/PinguyBuilder.log
  691. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  692. echo "ISOTMP info" >>$WORKDIR/PinguyBuilder.log
  693. ls -Rl $WORKDIR/ISOTMP >>$WORKDIR/PinguyBuilder.log
  694. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  695. echo "$WORKDIR/tmpusers info" >>$WORKDIR/PinguyBuilder.log
  696. cat $WORKDIR/tmpusers >>$WORKDIR/PinguyBuilder.log
  697. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  698. echo "Command-line options = $@" >>$WORKDIR/PinguyBuilder.log
  699. echo "------------------------------------------------------" >>$WORKDIR/PinguyBuilder.log
  700.  
  701.  
  702. # cleanup the install icons as they aren't needed on the current system
  703.  
  704. if [ "$1" = "backup" ]; then
  705. log_msg "Cleaning up the install icon from the user desktops"
  706. rm -rf /home/*/Desktop/ubiquity*.desktop &> /dev/null
  707. fi
  708.  
  709. #remove frontend from the system so the Install menu item does not appear.
  710. log_msg "Removing the ubiquity frontend as it has been included and is not needed on the normal system"
  711. apt-get -y -q remove ubiquity-frontend-kde &> /dev/null
  712. apt-get -y -q remove ubiquity-frontend-gtk &> /dev/null
  713. rm -rf /root/apt.tar.gz
  714.  
  715. sleep 1
  716. echo "cdfs debug 8"
  717. #checking the size of the compressed filesystem to ensure it meets the iso9660 spec for a single file"
  718. SQUASHFSSIZE=`ls -s $WORKDIR/ISOTMP/casper/filesystem.squashfs | awk -F " " '{print $1}'`
  719. if [ "$SQUASHFSSIZE" -gt "3999999" ]; then
  720. log_msg "The compressed filesystem is larger than genisoimage allows for a single file. You must try to reduce the amount of data you are backing up and try again."
  721. exit 1
  722. fi
  723.  
  724. #add filesystem size for lucid
  725. log_msg "Calculating the installed filesystem size for the installer"
  726.  
  727. unsquashfs -lls $WORKDIR/ISOTMP/casper/filesystem.squashfs | grep -v " inodes " | grep -v "unsquashfs:" | awk '{print $3}' | grep -v "," | grep [[:digit:]] > /tmp/size.tmp
  728. for i in `cat /tmp/size.tmp`; do a=$(($a+$i)); done
  729. echo $a > $WORKDIR/ISOTMP/casper/filesystem.size
  730.  
  731. log_msg "Removing PinguyBuilder-firstboot from system startup"
  732.  
  733. echo "cdfs debug9"
  734. #update-rc.d -f PinguyBuilder-firstboot remove
  735. chmod 644 /etc/init.d/PinguyBuilder-firstboot
  736.  
  737. echo "cdfs debug 10"
  738. }
  739.  
  740. iso (){
  741.  
  742. CREATEISO="`which mkisofs`"
  743. if [ "$CREATEISO" = "" ]; then
  744. CREATEISO="`which genisoimage`"
  745. fi
  746.  
  747. # check to see if the cd filesystem exists
  748.  
  749. if [ ! -f "$WORKDIR/ISOTMP/casper/filesystem.squashfs" ]; then
  750. log_msg "The filesystem.squashfs filesystem is missing. Either there was a problem creating the compressed filesystem or you are trying to run sudo PinguyBuilder dist iso before sudo PinguyBuilder dist cdfs"
  751. exit 1
  752. fi
  753. echo"cdfs debug11"
  754.  
  755. SQUASHFSSIZE=`ls -s $WORKDIR/ISOTMP/casper/filesystem.squashfs | awk -F " " '{print $1}'`
  756. if [ "$SQUASHFSSIZE" -gt "3999999" ]; then
  757. log_msg "The compressed filesystem is larger than genisoimage allows for a single file. You must try to reduce the amount of data you are backing up and try again."
  758. exit 1
  759. fi
  760. echo "cdfs debug 12"
  761. #Step 6.5 - Added by Tim Farley. Make ISO compatible with Ubuntu Startup Disk Creator (Karmic).
  762. log_msg "Making disk compatible with Ubuntu Startup Disk Creator."
  763. . /etc/lsb-release
  764. touch $WORKDIR/ISOTMP/ubuntu
  765. touch $WORKDIR/ISOTMP/.disk/base_installable
  766. echo "full_cd/single" > $WORKDIR/ISOTMP/.disk/cd_type
  767. ARCH=`archdetect | awk -F "/" '{print $1}'`
  768. # starting with 12.04 need to have correct ubuntu version or startup disk creator uses syslinux-legacy which won't work
  769. DISKINFONAME=`echo $LIVECDLABEL | awk '{print $1}'`
  770. echo $DISKINFONAME $DISTRIB_RELEASE - Release $ARCH > $WORKDIR/ISOTMP/.disk/info
  771. echo $LIVECDURL > $WORKDIR/ISOTMP/.disk/release_notes_url
  772.  
  773. # Step 7 - Make md5sum.txt for the files on the livecd - this is used during the
  774. # checking function of the livecd
  775. log_msg "Creating md5sum.txt for the livecd/dvd"
  776. cd $WORKDIR/ISOTMP && find . -type f -print0 | xargs -0 md5sum > md5sum.txt
  777.  
  778. #isolinux mode
  779.  
  780. # remove files that change and cause problems with checking the disk
  781. sed -e '/isolinux/d' md5sum.txt > md5sum.txt.new
  782. sed -e '/md5sum/d' md5sum.txt.new > md5sum.txt
  783. rm -f md5sum.txt.new &> /dev/null
  784.  
  785. sleep 1
  786.  
  787. # Step 8 - Make the ISO file
  788. log_msg "Creating $CUSTOMISO in $WORKDIR"
  789. $CREATEISO -iso-level 3 -quiet -r -V "$LIVECDLABEL" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -o $WORKDIR/$CUSTOMISO "$WORKDIR/ISOTMP" 2>>$WORKDIR/PinguyBuilder.log 1>>$WORKDIR/PinguyBuilder.log
  790. if [ ! -f $WORKDIR/$CUSTOMISO ]; then
  791. log_msg "The iso was not created. There was a problem. Exiting"
  792. exit 1
  793. fi
  794.  
  795. # Make the iso hybrid so it can be simply dd copied to a usb flash drive.
  796. log_msg "Making $CUSTOMISO a hybrid iso"
  797. isohybrid --uefi $WORKDIR/$CUSTOMISO
  798.  
  799. # create the md5 sum file so the user doesn't have to - this is good so the iso
  800. # file can later be tested to ensure it hasn't become corrupted
  801.  
  802. log_msg "Creating $CUSTOMISO.md5 in $WORKDIR"
  803.  
  804. cd $WORKDIR
  805. md5sum $CUSTOMISO > $CUSTOMISO.md5
  806.  
  807. sleep 1
  808.  
  809. log_msg "Creating $CUSTOMISO.sha256 in $WORKDIR"
  810.  
  811. cd $WORKDIR
  812. sha256sum $CUSTOMISO > $CUSTOMISO.sha256
  813.  
  814. sleep 1
  815.  
  816. ISOSIZE="`ls -hs $WORKDIR/$CUSTOMISO | awk '{print $1}'`"
  817.  
  818. log_msg "$WORKDIR/$CUSTOMISO which is $ISOSIZE in size is ready to be burned or tested in a virtual machine."
  819.  
  820. }
  821.  
  822. # check to see if either iso or cdfs options have been invoked and proceed accordingly
  823.  
  824. # Replaced this with a CASE statement, below
  825. #~ if [ "$2" = "iso" ]; then
  826. #~ iso $@
  827. #~ elif [ "$2" = "cdfs" ]; then
  828. #~ cdfs $@
  829. #~ else
  830. #~ cdfs $@
  831. #~ iso $@
  832. #~ fi
  833.  
  834. case $2 in
  835. iso )
  836. iso $@
  837. ;;
  838. cdfs )
  839. cdfs $@
  840. ;;
  841. * )
  842. cdfs $@
  843. iso $@
  844. ;;
  845. esac
  846.  
  847.  
  848.  
  849.  
  850. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement