diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-03-24 14:28:53 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-03-24 14:28:53 +0000 |
commit | 1be28d153669275cdceb86a183c52e19558c7b5d (patch) | |
tree | c211c059a326526581dfc7b7cf786c45cb44aa06 | |
parent | 95e6d1944459354f0cd589fdbe11fbf3a6680863 (diff) | |
download | live-1be28d153669275cdceb86a183c52e19558c7b5d.tar.gz |
Cleanup
-rwxr-xr-x | find-usr | 45 | ||||
-rwxr-xr-x | fs-root | 48 | ||||
-rwxr-xr-x | protostar | 46 |
3 files changed, 75 insertions, 64 deletions
diff --git a/find-usr b/find-usr deleted file mode 100755 index 4eece48..0000000 --- a/find-usr +++ /dev/null @@ -1,45 +0,0 @@ -#!/sbin/sh - -set -e -set -u -MOUNTPOINT="/cdrom" -USR='USR_IMG' - -# First, remount / read-write to update /dev -mount -o remount / - -# Second, update /dev -devfsadm -C -c disk - -# Now, search removable media for $USR -found='no' -for dfile in /dev/removable-media/dsk/*s2; do - # dfile="/dev/dsk/${d}" - if [ -e "$dfile" ]; then - echo "Probing \`$dfile' ..." - if mount -F hsfs -o ro "$dfile" "${MOUNTPOINT}" ; then - if [ -f "${MOUNTPOINT}/${USR}" ]; then - found='yes' - echo "Found ${USR}" - break - else - echo "${USR} not found" - umount "${MOUNTPOINT}" - fi - else - echo "Failed to mount \`$dfile'" - fi - fi -done - -if [ "$found" != 'yes' ]; then - echo "$USR not found" - exit 1 -fi - - -echo "Mounting \`${MOUNTPOINT}/${USR}' on /usr ..." -mount -F hsfs -o ro -O "${MOUNTPOINT}/${USR}" /usr - -exit 0 - @@ -0,0 +1,48 @@ +#!/sbin/sh + +set -e +set -u + +MOUNTPOINT="/cdrom" +USR='##USR_IMG##' + +export PATH=/sbin:/usr/sbin:/usr/bin + +# First, remount / read-write to update /dev +mount -o remount / >/dev/msglog 2>&1 + +# Second, update /dev +devfsadm -C -c disk + +# Now, search removable media for $USR +found='no' +for dfile in /dev/removable-media/dsk/*s2; do + if [ -e "$dfile" ]; then + echo "Probing \`$dfile' ..." >/dev/msglog + if mount -F hsfs -o ro "$dfile" "${MOUNTPOINT}" >/dev/msglog 2>&1 + then + if [ -f "${MOUNTPOINT}/${USR}" ]; then + found='yes' + echo "Found ${USR}" >/dev/msglog + break + else + echo "${USR} not found" >/dev/msglog + umount "${MOUNTPOINT}" + fi + else + echo "Failed to mount \`$dfile'" >/dev/msglog + fi + fi +done + +if [ "$found" != 'yes' ]; then + echo "$USR not found" >/dev/msglog + exit 1 +fi + + +echo "Mounting \`${MOUNTPOINT}/${USR}' on /usr ..." >/dev/msglog +mount -F hsfs -o ro -O "${MOUNTPOINT}/${USR}" /usr >/dev/msglog 2>&1 + +exit 0 + @@ -2,6 +2,7 @@ set -e set -u +set -x TMP="${TMP:-/var/tmp}" @@ -27,8 +28,8 @@ rm -rf "${ROOT}"/* echo "Preparing base system (debootstrap)..." debootstrap \ --no-check-gpg \ - --exclude=syslogd,gawk,aptitude \ - --include=illumos-grub,illumos-kernel,mc,vim-nox,openssh-client,wget,bzip2,xz-utils,debootstrap,less \ + --exclude=syslogd,gawk,aptitude,aptitude-common \ + --include=illumos-grub,illumos-kernel,mc,vim-tiny,openssh-client,openssh-server,wget,bzip2,xz-utils,debootstrap,less \ "${DIST}" \ "${ROOT}" \ "${REPO}" @@ -45,6 +46,8 @@ rm -rf "${ROOT}"/usr/share/doc/* devfsadm -r "${ROOT}" +sed -i '/^PermitRootLogin/ s,no,yes,' /etc/ssh/sshd_config + cat <<BOOTENV > $ROOT/boot/solaris/bootenv.rc setprop ata-dma-enabled 1 setprop atapi-cd-dma-enabled 1 @@ -68,8 +71,6 @@ cat <<VFSTAB > $ROOT/etc/vfstab VFSTAB -echo 'export LD_NOVERSION=1' >> $ROOT/etc/profile - echo "dyson-${DIST}-live" > "${ROOT}/etc/nodename" touch "${ROOT}/etc/hostname.e1000g0" touch "${ROOT}/etc/dhcp.e1000g0" @@ -78,30 +79,23 @@ touch "${ROOT}/etc/dhcp.e1000g0" echo 'root:root' | chpasswd -R "$ROOT" # 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 /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" +sed "s/##USR_IMG##/$USR_IMG/g" "fs-root" > "${ROOT}/lib/svc/method/fs-root" +chmod +x "${ROOT}/lib/svc/method/fs-root" + dummy_prog='#!/sbin/sh exit 0 ' +echo "$dummy_prog" > "${ROOT}/lib/svc/method/fs-usr" 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 -f "${ROOT}/etc/svc/repository.db" # 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" @@ -112,12 +106,22 @@ mkdir -p "${BOOTARCH}/cdrom" ( cd "${ROOT}" +# Move some critical libs: march=`dpkg-architecture -qDEB_HOST_MULTIARCH` mkdir -p lib/$march for lib in \ + libdiskmgt \ + libexacct \ libfmevent \ + libidmap \ + libipmi \ liblzma \ + libpool \ + libproject \ + libsmbios \ libsunavl \ + libtecla \ + libtopo \ libxml2 \ libz \ libzonecfg \ @@ -126,6 +130,12 @@ for lib in \ mv -v -f usr/lib/$lib.so.* lib/$march/ done +# Move usr/sbin to sbin: +find usr/sbin -type l -delete +mv usr/sbin/* sbin/ +rm -rf usr/sbin +ln -sf ../../sbin usr/sbin + # List here files or directories which # should be *moved* to boot archive. # Caution: files from /usr require @@ -162,7 +172,6 @@ tar -c -f - \ usr/bin/sh \ usr/lib/fs \ usr/lib/devfsadm \ - usr/sbin \ | tar xf - -C "${BOOTARCH}" # We need only kernel itself for GRUB. @@ -176,7 +185,7 @@ echo "Making boot archive..." sync; sync size=$(du -s -m "${BOOTARCH}" | cut -f1) -((size+=10)) # +10 MB of free space +((size+=20)) # +20 MB of free space dd if=/dev/zero of="${ROOT}/boot/boot_archive" bs=1M count="$size" lofidev=$(lofiadm -a "${ROOT}/boot/boot_archive") rlofidev="${lofidev/lofi/rlofi}" @@ -190,7 +199,6 @@ rmdir "${BOOTARCH}" rmdir "${ROOT}/boot/boot_archive.mount" gzip -9 -f "${ROOT}/boot/boot_archive" - echo "Making usr archive..." # usr will be mounted from usr.lzma: genisoimage \ |