Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am making a Ubuntu Remaster script that will take any 9.04/9.10 ubuntu.iso (xubuntu/kubuntu/ubuntu)
and will enable a person to add/remove pkgs, and additionally setup their desktop environment
with Xnest
and then the script receates the iso, so you have a pre-customized iso that will run and install
just like the original but with all your extra pkgs and desktop setup
so, I need some help on this one as my Bash ain't groovy yet
So
heres the main questions I have, as the script is working now
but needs refinement and:
1) I need to be able to fully upgrade the 9.04 iso to a 9.10, so how do I have the /etc/apt/sources.list
updated to karmic thru script?
2) I need to then remove the earlier/older kernel/initrd's completely
3) I need it also to be interactive, so thru the term the script asks you
what pkg's you want installed
the user would then type in or copy/paste in a list of pkgs, each seperated by a space
Example
iceweasel rox-filer opera
you know...then Xnest would start after installing the pkgs and you could setup desktop,etc
Here's a few pointers that i've picked up from Debian for upgrades.
First off it's advised to use aptitude for upgrades rather than apt-get.
Make sure 9.04 is up to date ,then change your sources.list to your target release;9.10.
Then aptitude update.
Next we'll need to install some packages so do: aptitude install apt dpkg aptitude.
Then do the upgrade with aptitude full-upgrade.
This has worked for me with Debian YMMV with Ubuntu though.
2) edit script to amke new cd and add pkgs
heres the script so far:
note that you must be running from a 9.10 install or livecd with your sources.list setup
Code:
#!/bin/bash
iso="ubuntu-mini-remix-9.10"
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..."
cp /etc/resolv.conf 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/ aptitude update
chroot squashfs-root/ aptitude -f safe-upgrade
chroot squashfs-root/ aptitude install lubuntu-desktop firefox flashplugin-nonfree
chroot squashfs-root/ aptitude clean
chroot squashfs-root/ aptitude autoclean
#cleanup chroot
echo "Cleaning up chroot..."
chroot squashfs-root/ rm -rf /tmp/*
chroot squashfs-root/ rm /etc/resolv.conf
chroot squashfs-root/ umount -l -f /proc
chroot squashfs-root/ umount -l -f /sys
chroot squashfs-root/ umount /dev/pts
exit
umount squashfs-root/dev
echo "Removing old SquashFS filesystem..."
rm image/casper/filesystem.squashfs
echo "Creating new SquashFS filesystem..."
mksquashfs squashfs-root image/casper/filesystem.squashfs
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 "ubuntu-mini-remix-9.10" -cache-inodes -J -l \
-b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table -o $iso_new.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
echo "Renaming new image, and moving original image to old..."
mv $iso.iso $iso_old.iso
mv $iso_new.iso $iso.iso
#cleanup working directory
echo "Cleaning up working directory..."
umount iso/
rm -rf squashfs-root
rm -rf image
rm -rf iso
rm filesystem.squashfs
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!"
Problems:
1) Howw to remove the old kernels/initrds without knowing the names/numbers??
I can use mv command to make a new kernel initrd for cd..
so I removed "exit" as maybe that made the script quit?
LOL
I also added
Code:
echo "Copying your kernel and initrd for the livecd"
cp squashfs-root/boot/vmlinuz-`uname -r` image/casper/vmlinuz
cp /boot/initrd.img-`uname -r` image/casper/initrd.lz
Update
so far its working but now I'm gonna start over a litlle
and first just use the full ubuntu-9.10 desktop iso
and add repos and apps I want
while removing bs like gnome-games,etc
Question:
after upgrading/installing
how do I, thru the terminal, remove the old kernel/initrd.img's???
thamks
now I'm at the point of playing with the ubuntu-9.10-desktop-i386.iso
and have the script thus far removing some stuff and adding some stuff and then mksquashfs'n it
heres partial script so far...
Please note its incomplete and
for some reason /dev wont umount?
Code:
chroot squashfs-root/ umount /dev
why doesn't that work??
Code:
#!/bin/bash
iso="ubuntu-9.10-desktop-i386"
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..."
cp /etc/resolv.conf 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/ aptitude update
chroot squashfs-root/ aptitude -f safe-upgrade
chroot squashfs-root/ aptitude purge evolution evolution-common evolution-couchdb evolution-documentation-en evolution-exchange evolution-indicator evolution-pluginsevolution-webcal gnome-games gnome-games-common openoffice.org-base-core openoffice.org-core
chroot squashfs-root/ apt-get autoremove
chroot squashfs-root/ aptitude install flashplugin-nonfree unetbootin isomaster
chroot squashfs-root/ aptitude clean
chroot squashfs-root/ aptitude autoclean
#cleanup chroot
echo "Cleaning up chroot..."
chroot squashfs-root/ rm -rf /tmp/*
chroot squashfs-root/ rm /etc/resolv.conf
chroot squashfs-root/ umount -l -f /proc
chroot squashfs-root/ umount -l -f /sys
chroot squashfs-root/ umount /dev/pts
chroot squashfs-root/ umount /dev
echo "Copying your kernel and initrd for the livecd"
cp squashfs-root/boot/vmlinuz-`uname -r` image/casper/vmlinuz
cp squashfs-root/boot/initrd.img-`uname -r` image/casper/initrd.lz
echo "Removing old SquashFS filesystem..."
rm image/casper/filesystem.squashfs
echo "Creating new SquashFS filesystem..."
mksquashfs squashfs-root image/casper/filesystem.squashfs
TODO includes adding the Xnest stuff and other stuff...?
The above script will make a squashfs of about 659MB
vs normal ubuntu 668MB
also, the above script will leave everything in the folder "image"
just transfer all that to fat32 usb with syslinux installed and it runs and installs
However, you must be root to do all that and then delete whatever
TODO:
1) make it so user's /home/name and /root desktops are configured and setup
possibly just using cp to copy users /home/name/* to /etc/skel/ and then chowning,etc /etc/skel?
2) Possibly figure out how to integrate xnest into script and how to make script interactive??
OK
To run the script you need these things-
1) either running from livecd/usb with access to a 5+GB ext2/3 partition
or running from a fresh 9.10 install with all your settings set up and at least 3GB free space
OK
so, now explaining about the script
first, this script will install chromium-browser, opera, flash, and more if left unedited
adjust remove/install pkgs!
these things must be in a folder(any name) on your Desktop or somewhere on a partition
#!/bin/bash
iso="ubuntu-9.10-desktop-i386"
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
so, in the above it will mount the iso, install genisoimage & squashfs-tools if you dont have thm...
and then unsquashfs the original compressed fs
here it sets up the chroot and updates apt
BIG NOTE!
you must have your /etc/apt/sources.list fully setup
a good place to start is here http://repogen.simplylinux.ch/
after that it basically recreates the original ubuntu iso, with all your changes, and names it
ubuntu-9.10-desktop-i386-new.iso
so, thats where I'm at right now....
EDIT: I'm making the 3rd test iso now, will put it on usb and install
will report in next post during install and show pics
I am currently messing with like 5 scripts i made for re-inventing ubuntu's
Theres this one for upgrading/adding apps to reg ubuntu iso^
and I have a good one for using the small ubuntu-mini-remix http://www.crealabs.it/ubuntu-mini-remix/
where I addded fluxbox and lite apps and its like 350MB with all the goodies
and this one I used ubuntu-rescue-remix http://ubuntu-rescue-remix.org/
and am now adding all the rescue tools and LXDE desktop and at 400MB!
so, gonna want to put these scripts/tutorials somewhere as my site is not permenent
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.