File indexing completed on 2024-04-28 04:48:05

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=$1
0027 
0028         dcop --all-users amarok playlist popupMessage "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         which mksquashfs
0031     if [[ $? == 0 ]]; then
0032         mksquashfs $WORK/amarok.live/ $WORK/mklivecd/livecd/livecd.sqfs -noappend
0033     else
0034         dcop --all-users amarok playlist popupMessage "Squashfs-tools not found! Make sure mksquashfs is in your root \$PATH"
0035         exit
0036     fi
0037 
0038         olddir=`pwd`
0039         cd $WORK/mklivecd
0040         dd if=/dev/zero of=livecd/isolinux/initrd bs=1k count=6646
0041         mke2fs -q -m 0 -F -N 1250 -s 1 livecd/isolinux/initrd
0042         mount -o loop -t ext2 livecd/isolinux/initrd initrd.mnt
0043         rm -rf initrd.mnt/lost+found
0044         (cd initrd.dir ; tar cf - .) | (cd initrd.mnt ; tar xf -)
0045         umount initrd.mnt
0046         cd livecd/isolinux
0047         gzip -f -9 initrd
0048         cd ..
0049         ll
0050         rm -f livecd.iso
0051         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 .
0052         cd $olddir
0053 #       mv $WORK/Amarok.live.custom.iso .
0054 
0055 
0056 # Let's test for the presence of k3b, and if it is there load it up 
0057 # and burn the cd iso right away.  If k3b is not present, show a kde 
0058 # dialog telling the user where the iso is.
0059 
0060     which k3b
0061 
0062         if [[ $? == 0 ]] ; then
0063         k3b --cdimage $WORK/Amarok.live.custom.iso
0064     else 
0065         kdialog --title "Amarok livecd remaster" --msgbox "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."
0066     fi
0067 
0068     kdialog --title "Amarok livecd remaster" --yesno "Do you want to make more cds later? If so, please click yes, and you can simply add more songs. If you are done, click no and the temporary files will be erased. You will need to rerun configure to make another cd."
0069 
0070         if [[ $? = 1 ]]; then
0071                 rm -rf $WORK/mklivecd
0072                 rm -rf $WORK/amarok.*
0073         echo "end" > /tmp/amarok.script
0074         fi
0075 
0076         
0077 else
0078         kdialog --title "Amarok livecd remaster" --sorry "You must run this script as root. Try running 'kdesu sh amarok.live.remaster.part1.sh' instead."
0079 fi