diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-02-15 07:42:00 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-02-15 07:42:00 +0400 |
commit | 41284ed0df08d85e4288b27342befe12ab4601f4 (patch) | |
tree | 4e9f7d322eccbb5b2c48b8740c9b3649da54e9d8 /protostar | |
parent | a677850ad6f94d03ab2805b1d1a4c28e6be01c11 (diff) | |
download | live-41284ed0df08d85e4288b27342befe12ab4601f4.tar.gz |
First bootable LiveCD!
Diffstat (limited to 'protostar')
-rwxr-xr-x | protostar | 54 |
1 files changed, 39 insertions, 15 deletions
@@ -1,6 +1,5 @@ #!/bin/bash - set -e set -u @@ -9,7 +8,6 @@ TMP="${TMP:-/tmp}" DATE=$(date '+%Y-%m-%d-%H%M') DIST="${DIST:-bok}" REPO="${REPO:-http://apt.osdyson.org}" -REPO="file:///repo/" # We will search for usr archive on CD: USR_IMG=usr.img.$(echo $DATE | md5sum | cut -f1 -d ' ') @@ -24,23 +22,39 @@ if [ -z "${ROOT}" ] || [ "${ROOT}" = / ]; then exit 1 fi +rm -rf "${ROOT}"/* + echo "Preparing base system (debootstrap)..." debootstrap \ --no-check-gpg \ --exclude=syslogd,gawk \ - --include=illumos-grub,illumos-kernel,ufsutils \ + --include=illumos-grub,illumos-kernel,ufsutils,hsfs,mc,vim,illumos-ssh-client,wget,gzip,bzip2,debootstrap,less \ "${DIST}" \ "${ROOT}" \ - "${REPO}" >/dev/null + "${REPO}" # This stuff does not make sense for LiveCD: rm -rf "${ROOT}"/var/lib/dpkg/info +rm -rf "${ROOT}"/var/lib/apt rm -rf "${ROOT}"/var/cache/* rm -rf "${ROOT}"/etc/cron.* rm -rf "${ROOT}"/var/log/* rm -rf "${ROOT}"/var/adm/* rm -rf "${ROOT}"/usr/share/doc/* +# Remove 32-bit modules: +( cd "${ROOT}" +find kernel platform usr/kernel usr/platform -type f -path '*/amd64/*' \ +| while read amd64; do + i86=${amd64/amd64\//} + if [ -f "$i86" ]; then + echo "Removing $i86" + rm "$i86" + fi +done +) + + devfsadm -r "${ROOT}" cat <<VFSTAB > $ROOT/etc/vfstab @@ -60,33 +74,43 @@ VFSTAB echo 'export LD_NOVERSION=1' >> $ROOT/etc/profile -echo 'dyson-live' > "${ROOT}/etc/nodename" +echo "dyson-${DIST}-live" > "${ROOT}/etc/nodename" touch "${ROOT}/etc/hostname.e1000g0" touch "${ROOT}/etc/dhcp.e1000g0" -echo '127.0.0.1 localhost loghost' > "${ROOT}/etc/inet/hosts" +echo '127.0.0.1 localhost loghost' > "${ROOT}/etc/inet/hosts" # Hack to know root password: sed -i '/^root/d' $ROOT/etc/shadow grep root /etc/shadow >> $ROOT/etc/shadow +echo 'User: root, password: root' >> "${ROOT}/etc/issue" # Script to find and mount usr.lzma: sed "s/USR_IMG/$USR_IMG/" "find-usr" > "${ROOT}/lib/svc/method/find-usr" chmod +x "${ROOT}/lib/svc/method/find-usr" -sed -i '/readvfstab "\/usr"/i bash /lib/svc/method/find-usr >/dev/msglog 2>&1' \ +sed -i '/readvfstab "\/usr"/i /lib/svc/method/find-usr >/dev/msglog 2>&1' \ "${ROOT}/lib/svc/method/fs-root" # WE DON"T NEED BOOTARCHIVE ON LIVECD. # Thank you! sed -i '/if \[ -f "${UPDATEFILE}" \]; then/ i exit $SMF_EXIT_OK' \ "${ROOT}/lib/svc/method/fs-usr" +dummy_prog='#!/sbin/sh +exit 0 +' +echo "$dummy_prog" > "${ROOT}/lib/svc/method/boot-archive" +echo "$dummy_prog" > "${ROOT}/lib/svc/method/boot-archive-update" echo "Importing manifests..." rm "${ROOT}/lib/svc/manifest/system/early-manifest-import.xml" -#rm "${ROOT}/lib/svc/manifest/system/manifest-import.xml" + +# bash or ksh, please: bash "${ROOT}/lib/svc/method/manifest-import" \ -f "${ROOT}/etc/svc/repository.db" \ -d "${ROOT}/lib/svc/manifest" +# Thank you! Bye-bye! +echo "$dummy_prog" > "${ROOT}/lib/svc/method/manifest-import" + mkdir -p "${BOOTARCH}" mkdir -p "${BOOTARCH}/usr" @@ -100,6 +124,7 @@ mkdir -p "${BOOTARCH}/cdrom" # special treating: see below. tar --remove-files -c -f - \ boot/solaris/devicedb/master \ + boot/solaris/bootenv.rc \ bin \ dev \ devices \ @@ -123,7 +148,6 @@ tar --remove-files -c -f - \ # same, but keep source tar -c -f - \ platform \ - usr/bin/bash \ usr/bin/cat \ usr/bin/dash \ usr/bin/ls \ @@ -146,12 +170,12 @@ sync; sync if false; then genisoimage \ - -o "${ROOT}/boot/boot_archive" \ - -N -l -R -U \ - -allow-multidot \ - -quiet -no-iso-translate -cache-inodes -d -D \ - -V "root" \ - "${BOOTARCH}" + -o "${ROOT}/boot/boot_archive" \ + -N -l -R -U \ + -allow-multidot \ + -quiet -no-iso-translate -cache-inodes -d -D \ + -V "root" \ + "${BOOTARCH}" else size=$(du -s -m "${BOOTARCH}" | cut -f1) dd if=/dev/zero of="${ROOT}/boot/boot_archive" bs=1M count="$size" |