diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-03-24 18:37:16 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-03-24 18:37:16 +0000 |
commit | 9905994b04e05b51fec788857740bf365aed1d73 (patch) | |
tree | 10ecca41750b6b39717501d125bbcfce89170b20 | |
parent | 1be28d153669275cdceb86a183c52e19558c7b5d (diff) | |
download | live-9905994b04e05b51fec788857740bf365aed1d73.tar.gz |
Reduce ISO size by using two /usr: /usr1 and /usr2
-rwxr-xr-x | fs-root | 7 | ||||
-rwxr-xr-x | protostar | 78 |
2 files changed, 59 insertions, 26 deletions
@@ -41,8 +41,11 @@ if [ "$found" != 'yes' ]; then fi -echo "Mounting \`${MOUNTPOINT}/${USR}' on /usr ..." >/dev/msglog -mount -F hsfs -o ro -O "${MOUNTPOINT}/${USR}" /usr >/dev/msglog 2>&1 +echo "Mounting \`${MOUNTPOINT}/${USR}' on /usr2 ..." >/dev/msglog +mount -F hsfs -o ro -O "${MOUNTPOINT}/${USR}" /usr2 >/dev/msglog 2>&1 +echo "Switching /usr to /usr2 ..." >/dev/msglog +rm -f /usr +ln -sf /usr2 /usr exit 0 @@ -18,6 +18,24 @@ ISONAME="${ISONAME:-dyson-${DIST}-${DATE}}.iso" ROOT="${TMP}/ROOT" BOOTARCH="${ROOT}/boot_archive" + +# Move files from usr to usr1, +# Create links from usr to usr1. +# E. g.: +# usr_symlink_move usr/bin/bash +# /usr/bin/bash -> /usr1/bin/bash +# usr_symlink_move usr/lib/devfsadm +# /usr/lib/devfsadm -> /usr1/lib/devfsadm +usr_symlink_move() { + f=${1#*/} # NO LEADING SLASH! + d=$(dirname "$f") + if [ ! -d "usr1/$d" ]; then + mkdir -p "usr1/$d" + fi + mv -v "usr/$f" "usr1/$f" + ln -sf "/usr1/$f" "usr/$f" +} + if [ -z "${ROOT}" ] || [ "${ROOT}" = / ]; then echo "WTF? Bad root: \`${ROOT}'" >&2 exit 1 @@ -28,7 +46,7 @@ rm -rf "${ROOT}"/* echo "Preparing base system (debootstrap)..." debootstrap \ --no-check-gpg \ - --exclude=syslogd,gawk,aptitude,aptitude-common \ + --exclude=syslogd,gawk,aptitude,aptitude-common,libboost-iostreams1.48.0,libboost-iostreams1.49.0,libcwidget3 \ --include=illumos-grub,illumos-kernel,mc,vim-tiny,openssh-client,openssh-server,wget,bzip2,xz-utils,debootstrap,less \ "${DIST}" \ "${ROOT}" \ @@ -104,8 +122,7 @@ mkdir -p "${BOOTARCH}" mkdir -p "${BOOTARCH}/usr" mkdir -p "${BOOTARCH}/cdrom" -( cd "${ROOT}" - +pushd "${ROOT}" # Move some critical libs: march=`dpkg-architecture -qDEB_HOST_MULTIARCH` mkdir -p lib/$march @@ -136,14 +153,30 @@ mv usr/sbin/* sbin/ rm -rf usr/sbin ln -sf ../../sbin usr/sbin +# Moving some files from usr to usr1 +# and creating symlinks from usr to usr1 +usr_symlink_move usr/bin/cat +usr_symlink_move usr/bin/dash +usr_symlink_move usr/bin/ls +usr_symlink_move usr/bin/sh +usr_symlink_move usr/lib/devfsadm +usr_symlink_move usr/lib/fs + +# usr2 will be packed and stored on CD: +mv usr usr2 + +# This is usr before usr2 is mounted, +# fs-root will mount usr2 and replace usr -> usr2 +ln -sf usr1 usr + # List here files or directories which # should be *moved* to boot archive. # Caution: files from /usr require -# special treating: see below. +# special treating: see above tar --remove-files -c -f - \ - boot/solaris/devicedb/master \ - boot/solaris/bootenv.rc \ bin \ + boot/solaris/bootenv.rc \ + boot/solaris/devicedb/master \ dev \ devices \ etc \ @@ -153,6 +186,7 @@ tar --remove-files -c -f - \ media \ mnt \ opt \ + platform \ proc \ root \ run \ @@ -160,26 +194,23 @@ tar --remove-files -c -f - \ srv \ system \ tmp \ + usr \ + usr1 \ var \ | tar xf - -C "${BOOTARCH}" -# same, but keep source -tar -c -f - \ - platform \ - usr/bin/cat \ - usr/bin/dash \ - usr/bin/ls \ - usr/bin/sh \ - usr/lib/fs \ - usr/lib/devfsadm \ -| tar xf - -C "${BOOTARCH}" +# Restore the kernel: +mkdir -p platform/i86pc/kernel/amd64 +cp -p "${BOOTARCH}/platform/i86pc/kernel/amd64/unix" \ + platform/i86pc/kernel/amd64/ + +# Mount point for compressed /usr: +mkdir "${BOOTARCH}/usr2" -# We need only kernel itself for GRUB. -# BTW, kernel should be in boot archive as well (WTF?) -find platform -type f -a ! -name unix -delete -) +popd # Exit from $ROOT -find "${BOOTARCH}" > bootarch.list + +find "${BOOTARCH}" -ls > bootarch.list echo "Making boot archive..." sync; sync @@ -207,9 +238,9 @@ genisoimage \ -allow-multidot \ -quiet -no-iso-translate -cache-inodes -d -D \ -V "usr" \ - "${ROOT}/usr" + "${ROOT}/usr2" -rm -rf "${ROOT}/usr" +rm -rf "${ROOT}/usr2" lofiadm -C lzma "${ROOT}/${USR_IMG}" @@ -223,7 +254,6 @@ background=215ECA title Dyson ($DIST), $DATE kernel /platform/i86pc/kernel/amd64/unix -k -m verbose module /boot/boot_archive.gz - GRUB echo "Making final ${ISONAME}..." |