there's the need for me to have a CD (not DVD) with LMDE, because of non PAE CPU support. Since there's no CD image download anymore I tried myself with the help of this forum and several other sources to shrink the iso file.
At the moment I've no luck to get it shrinked to the estimated size inspite of purging more than 650MB from the linuxmint-201303-mate-dvd-32bit.iso.
After all processing I get about 1.04GB.
here is my script that does the work:
Code: Select all
#!/bin/bash
iso="linuxmint-201303-mate-dvd-32bit"
if [ "$UID" -ne "0" ]
then
echo "This script will only work when run by "root"."
exit 1
fi
# not everyone will have squash tools, install them if not found
if [ ! `which unsquashfs` ]
then
aptitude install squashfs-tools
fi
# not everyone will have genisoimage, install it if not found
if [ ! `which mkisofs` ]
then
aptitude install genisoimage
fi
START=$(date +%s)
mkdir iso
mount $iso.iso iso/ -o loop
cp -R iso/ image/
echo "Decompressing SquashFS..."
cp iso/casper/filesystem.squashfs ./
unsquashfs filesystem.squashfs
echo "Setting up Live CD chroot..."
mkdir -p squashfs-root/etc/
touch squashfs-root/etc/resolv.conf
echo "nameserver 208.67.220.220" >> squashfs-root/etc/resolv.conf
echo "nameserver 208.67.222.222" >> squashfs-root/etc/resolv.conf
echo "nameserver 4.2.2.4" >> squashfs-root/etc/resolv.conf
echo "nameserver 4.2.2.5" >> squashfs-root/etc/resolv.conf
cp /etc/hosts squashfs-root/etc/
cp /etc/apt/sources.list squashfs-root/etc/apt/sources.list
mount --bind /dev/ squashfs-root/dev
chroot squashfs-root/ mount -t proc none /proc
chroot squashfs-root/ mount -t sysfs none /sys
chroot squashfs-root/ mount -t devpts none /dev/pts
export HOME=/root
export LC_ALL=C
echo "Refreshing and Upgrading Packages"
chroot squashfs-root/ apt-get update
chroot squashfs-root/ apt-get -y purge libreoffice-core gimp-data thunderbird freepats pidgin-data openjdk-6-jre-headless w32codecs mint-x-icons python-qt4 build-essential evolution-data-server-common thunderbird-l10n-en-us
chroot squashfs-root/ aptitude purge ~c
chroot squashfs-root/ aptitude unmarkauto ~M
chroot squashfs-root/ apt-get clean
chroot squashfs-root/ aptitude autoclean
chroot squashfs-root/ rm -rf /var/cache/debconf/*.dat-old
chroot squashfs-root/ rm -rf /var/lib/aptitude/*.old
chroot squashfs-root/ rm -rf /var/lib/dpkg/*-old
chroot squashfs-root/ rm -rf /var/cache/apt/*.bin
#cleanup chroot
echo "Cleaning up chroot..."
chroot squashfs-root/ rm -rf /tmp/*
chroot squashfs-root/ rm -f /etc/resolv.conf
chroot squashfs-root/ umount -l -f /proc
chroot squashfs-root/ umount -l -f /sys
chroot squashfs-root/ umount /dev/pts
umount squashfs-root/dev
chroot squashfs-root/ dpkg-query -W --showformat='${Package} ${Version}\n' > image/casper/filesystem.manifest
echo "Removing old SquashFS filesystem..."
rm image/casper/filesystem.squashfs
echo "Creating new SquashFS filesystem..."
mksquashfs squashfs-root image/casper/filesystem.squashfs -comp xz
echo "Finding and creating MD5 hash sums of files in image..."
cd image
find . -type f -print0 | xargs -0 md5sum > md5sum.txt
cd ..
echo "Creating new image..."
mkisofs -r -V "${iso}" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o "${iso}_remaster.iso" image/
# Make sure that mkisofs succeeded before we try moving or renaming
# any images.
if [ $? != "0" ]
then
echo "mkisofs failed with error code: $?"
exit
fi
#cleanup working directory
echo "Cleaning up working directory..."
umount iso/
rm -rf squashfs-root
rm -rf image
rm -rf iso
rm -f filesystem.squashfs
rm -f umr-livecd.sums
echo "Getting MD5 and SHA1 sum of image..."
echo "MD5: " > umr-livecd.sums
md5sum $iso.iso >> umr-livecd.sums
echo "SHA1: " >> umr-livecd.sums
sha1sum $iso.iso >> umr-livecd.sums
END=$(date +%s)
echo "Done at `date`. The whole process took $(($END - $START)) seconds!"
Could anybody point me where to make efficient changes to the script, to get it done properly?
Thanks in advance!
kind regards
Christian
[edit]Oops! Sorry, I've read it right after posting the message: "Do not start a support topic here please."[/edit]