File indexing completed on 2025-01-05 04:27:23

0001 #!/usr/bin/env bash
0002 
0003 ############################################################################
0004 # Second part of the Amarok LiveCD remastering scripts
0005 # Reassemble the iso after adding media files
0006 #
0007 # Based on a script authored by Ivan Kerekes <ikerekes@gmail.com>
0008 # and modified by Leo Franchi <lfranchi at gmail.com>, Mike Diehl 
0009 # <madpenguin8 at yahoo.com> and Greg Meyer <greg at gkmweb.com> 
0010 #
0011 # See the file called README for more information
0012 ############################################################################
0013 #
0014 # This program is free software; you can redistribute it and/or modify
0015 # it under the terms of the GNU General Public License as published by
0016 # the Free Software Foundation; either version 2 of the License, or
0017 # (at your option) any later version.
0018 #
0019 ############################################################################
0020 
0021 # script must be run as root, first check for and exit if not
0022 # then resquash the users' new fs
0023 
0024 if [ `/usr/bin/whoami` = 'root' ]; then
0025 
0026         WORK=`kdialog --title "Choose working directory" --getexistingdirectory .`
0027 
0028         kdialog --title "Amarok livecd remaster" --msgbox "The music that you added is now being squashed and added to the livecd. Please be VERY patient as this step can take a LONG time."
0029         
0030         mksquashfs $WORK/amarok.live/ $WORK/mklivecd/livecd/livecd.sqfs -noappend
0031 
0032 
0033         olddir=`pwd`
0034         cd $WORK/mklivecd
0035         dd if=/dev/zero of=livecd/isolinux/initrd bs=1k count=4646
0036         mke2fs -q -m 0 -F -N 1250 -s 1 livecd/isolinux/initrd
0037         mount -o loop -t ext2 livecd/isolinux/initrd initrd.mnt
0038         rm -rf initrd.mnt/lost+found
0039         (cd initrd.dir ; tar cf - .) | (cd initrd.mnt ; tar xf -)
0040         umount initrd.mnt
0041         cd livecd/isolinux
0042         gzip -f -9 initrd
0043         cd ..
0044         ll
0045         rm -f livecd.iso
0046         mkisofs -J -R -V "Livecd Test" -o $WORK/Amarok.live.custom.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table .
0047         cd $olddir
0048         mv $WORK/Amarok.live.custom.iso .
0049         
0050         kdialog --title "Amarok livecd remaster" --yesno "Livecd creation is done. The new Amarok live image is in `pwd`, called Amarok.live.custom.iso. You can burn that with any standard burner and enjoy.
0051         
0052         Do you want to make more cds later? If so, please click yes, and you can simply re-run part2 of this script. If you are done, click no and the temporary files will be erased. You will need to rerun part1 to make another cd."
0053         
0054         if [[ $? = 1 ]]; then
0055                 rm -rf $WORK/mklivecd/
0056                 rm -rf $WORK/amarok.live/
0057         fi
0058 
0059         
0060 else
0061         kdialog --title "Amarok livecd remaster" --sorry "You must run this script as root. Try running 'kdesu sh amarok.live.remaster.part1.sh' instead."
0062 
0063 fi