Cleanup unionfs code and replace with overlayfs where appropriate

This commit is contained in:
Silvan Calarco 2013-03-04 11:25:58 +01:00
parent 688b574aff
commit 08dde5e397
14 changed files with 13 additions and 109 deletions

View File

@ -17,7 +17,7 @@ $(MAKEDIST_TARGET)-commontools: sysvinit util-linux module-init-tools \
dosfstools man mbr iptables cups vim iputils sudo postplug xinetd less \ dosfstools man mbr iptables cups vim iputils sudo postplug xinetd less \
reiserfsprogs ppp b43-tools mdadm usb-modeswitch \ reiserfsprogs ppp b43-tools mdadm usb-modeswitch \
usbutils ftp telnet eject bluez lsof \ usbutils ftp telnet eject bluez lsof \
tcpdump pcmcia-utils xdg-utils unionfs_utils iproute $(MAKEDIST_TARGET)-firmwares \ tcpdump pcmcia-utils xdg-utils iproute $(MAKEDIST_TARGET)-firmwares \
$(MAKEDIST_TARGET)-devel $(MAKEDIST_TARGET)-devel
$(MAKEDIST_TARGET)-debug: strace valgrind gdb minicom openssh-server dhcpclient rpm iputils \ $(MAKEDIST_TARGET)-debug: strace valgrind gdb minicom openssh-server dhcpclient rpm iputils \
openssh-clients diffutils Mesa-tools kbd mc openmamba-release openssh-clients diffutils Mesa-tools kbd mc openmamba-release

View File

@ -10,7 +10,7 @@ chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${KERNEL_EXTRAVER}
# make initramfs # make initramfs
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \
${KERNEL_MAJVER}${KERNEL_EXTRAVER} ${KERNEL_MAJVER}${KERNEL_EXTRAVER}

View File

@ -1,96 +0,0 @@
FOUND_ISO=
#RAMSIZE=100000 -o "size=${RAMSIZE}k"
msg ":: Creating new root ramdisk (dinamic size=${RAMSIZE}k) on /dev/shm..."
mkdir -p /flash /cdrom /squashfs ${NEWROOT}
#
# findiso(): looks for ISO9660 images stored in flash root
#
findiso(){
msg ":: Looking for openmamba ISO cdrom images"
# try removable devices only
for i in /flash/openmamba-*.iso; do
/bin/losetup /dev/loop0 $i
if mount -r -t iso9660 /dev/loop0 /cdrom >/dev/null 2>&1; then
if test -r /cdrom/rootfs.compressed; then
msg ":: Valid ISO image $i found..."
FOUND_ISO="$i"
return 0
fi
umount /cdrom
fi
/bin/losetup /dev/loop0
done
return 1
}
#/sbin/splash_util -c repaint ${splash_add} -t default --mesg="Looking for cdrom device" --progress="4444"
while true; do
msg ":: root device is ${root}"
if ! mount -t ext3 ${root} /flash >/dev/null 2>&1; then
if ! mount -t ext2 ${root} /flash >/dev/null 2>&1; then
err ":: Unable to mount USB rootfs. Supported filesystems are ext2 and ext3."
fi
fi
findiso
if [ "$FOUND_ISO" ]; then
# /sbin/splash_util -c repaint ${splash_add} -t default --mesg="Mounting compressed filesystem" --progress="5555"
msg ":: Mounting compressed filesystem"
/bin/losetup /dev/loop1 /cdrom/rootfs.compressed
mount -r -t squashfs /dev/loop1 /squashfs
if [ "${unionfs}" != "off" -a "${unionfs}" != "OFF" ]; then
[ "${unionfs}" = "reset" ] && {
msg ":: Resetting unionfs data in rwroot"
mkdir -p /flash/old
mv /flash/rwroot /flash/old/
}
msg ":: Mounting unionfs"
mkdir -p /flash/rwroot
mount -t unionfs -o dirs=/flash/rwroot=rw:/squashfs=ro unionfs ${NEWROOT}
mkdir -p ${NEWROOT}/squashfs ${NEWROOT}/flash ${NEWROOT}/cdrom
mount -n -o move /squashfs ${NEWROOT}/squashfs
mount -n -o move /flash ${NEWROOT}/flash
mount -n -o move /cdrom ${NEWROOT}/cdrom
else
msg ":: Creating directories and symlinks on ramdisk..."
/bin/mount -t tmpfs /dev/shm ${NEWROOT}
mkdir -p \
${NEWROOT}/tmp ${NEWROOT}/proc ${NEWROOT}/sys \
${NEWROOT}/initrd ${NEWROOT}/mnt ${NEWROOT}/media \
${NEWROOT}/oldroot ${NEWROOT}/squashfs ${NEWROOT}/flash \
${NEWROOT}/cdrom
mount -n -o move /squashfs ${NEWROOT}/squashfs
mount -n -o move /flash ${NEWROOT}/flash
mount -n -o move /cdrom ${NEWROOT}/cdrom
ln -s squashfs/bin ${NEWROOT}/bin
ln -s squashfs/boot ${NEWROOT}/boot
ln -s squashfs/lib ${NEWROOT}/lib
ln -s squashfs/opt ${NEWROOT}/opt
ln -s squashfs/sbin ${NEWROOT}/sbin
ln -s squashfs/srv ${NEWROOT}/srv
ln -s squashfs/usr ${NEWROOT}/usr
chroot ${NEWROOT} /bin/cp -a \
/squashfs/dev /squashfs/home /squashfs/var \
/squashfs/etc /squashfs/root /
fi
# Create empty utmp and wtmp
#:> ${NEWROOT}/var/run/utmp
#:> ${NEWROOT}/var/run/wtmp
# [ "${init}" ] || init=/sbin/init
# msg ":: Running init, runlevel:${runlevel}"
# exec run-init ${NEWROOT} ${init} ${runlevel}
# msg ":: Could not run init; opening a command prompt."
# /bin/sh.shared
else
msg ":: FATAL ERROR: could not find a valid ISO image."
# /bin/sh.shared
fi
done

View File

@ -3,7 +3,7 @@
chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${KERNEL_EXTRAVER} chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${KERNEL_EXTRAVER}
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \
${KERNEL_MAJVER}${KERNEL_EXTRAVER} ${KERNEL_MAJVER}${KERNEL_EXTRAVER}

View File

@ -2,7 +2,7 @@
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K} chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K}
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \
${KERNEL_MAJVER}${K} ${KERNEL_MAJVER}${K}

View File

@ -14,7 +14,7 @@ sed -i '/^[4-6]:.*/d' $MOUNTDIR/etc/inittab
chroot $MOUNTDIR depmod -a chroot $MOUNTDIR depmod -a
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \
${KERNEL_MAJVER}${KERNEL_EXTRAVER} ${KERNEL_MAJVER}${KERNEL_EXTRAVER}

View File

@ -13,7 +13,7 @@ sed -i '/^[4-6]:.*/d' $MOUNTDIR/etc/inittab
# make initramfs # make initramfs
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \
${KERNEL_MAJVER}${KERNEL_EXTRAVER} ${KERNEL_MAJVER}${KERNEL_EXTRAVER}

View File

@ -6,7 +6,7 @@
# make initramfs # make initramfs
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \
${KERNEL_MAJVER}${KERNEL_EXTRAVER} ${KERNEL_MAJVER}${KERNEL_EXTRAVER}

View File

@ -10,7 +10,7 @@
chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${KERNEL_EXTRAVER} chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${KERNEL_EXTRAVER}
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \
${KERNEL_MAJVER}${KERNEL_EXTRAVER} ${KERNEL_MAJVER}${KERNEL_EXTRAVER}

View File

@ -11,7 +11,7 @@ ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K} chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K}
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \
${KERNEL_MAJVER}${K} ${KERNEL_MAJVER}${K}

View File

@ -11,7 +11,7 @@ ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K} chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K}
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \
${KERNEL_MAJVER}${K} ${KERNEL_MAJVER}${K}

View File

@ -15,7 +15,7 @@ $(MAKEDIST_TARGET)-sdk-root: openssh-server usbutils wireless_tools parted \
tightvnc-server lxde midori $(MAKEDIST_TARGET)-devel icecc tightvnc-server lxde midori $(MAKEDIST_TARGET)-devel icecc
$(MAKEDIST_TARGET)-sdk-root-missing: wpa_supplicant dosfstools cups vim postplug ipw2100-firmware ipw2200-firmware zd1211-firmware \ $(MAKEDIST_TARGET)-sdk-root-missing: wpa_supplicant dosfstools cups vim postplug ipw2100-firmware ipw2200-firmware zd1211-firmware \
rt2501-firmware rt2870-firmware b43-tools r5u87x-firmware mdadm \ rt2501-firmware rt2870-firmware b43-tools r5u87x-firmware mdadm \
ndiswrapper slmodem unionfs_utils nfs-utils mbr ndiswrapper slmodem nfs-utils mbr
$(MAKEDIST_TARGET)-sdk-root-en: $(MAKEDIST_TARGET)-sdk-root-en:
$(MAKEDIST_TARGET)-sdk-root-it: $(MAKEDIST_TARGET)-sdk-root-it:
$(MAKEDIST_TARGET)-sdk-root-es: $(MAKEDIST_TARGET)-sdk-root-es:

View File

@ -11,7 +11,7 @@ ISOID=
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K} chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K}
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \
${KERNEL_MAJVER}${K} ${KERNEL_MAJVER}${K}

View File

@ -6,7 +6,7 @@
# make initramfs # make initramfs
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \ LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
--filesystems "ext3 ext4 unionfs squashfs isofs reiserfs" \ --filesystems "ext3 ext4 overlayfs squashfs isofs reiserfs" \
--nomdadmconf --nolvmconf \ --nomdadmconf --nolvmconf \
/boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \ /boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \
${KERNEL_MAJVER}${KERNEL_EXTRAVER} ${KERNEL_MAJVER}${KERNEL_EXTRAVER}