From 92f518209b7550c78843bc2dcaa2b2f677be0908 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Mon, 25 Mar 2013 00:36:26 +0000 Subject: Can create bootable CD again --- fs-root | 36 +++++++++++++++++++++++------------- protostar | 23 ++++++++++++++++++----- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/fs-root b/fs-root index a59cb1f..a7b8eb4 100755 --- a/fs-root +++ b/fs-root @@ -6,44 +6,54 @@ set -u MOUNTPOINT="/cdrom" USR='##USR_IMG##' -export PATH=/sbin:/usr/sbin:/usr/bin +export PATH=/sbin:/usr1/sbin:/usr1/bin +exec >/dev/msglog 2>&1 # First, remount / read-write to update /dev -mount -o remount / >/dev/msglog 2>&1 +mount -o remount / -# Second, update /dev +# The sd nodes are not created till you try to access them. +echo "Probing for device nodes ..." +ls -lR /devices/* >/dev/null devfsadm -C -c disk +echo "Mounting /usr image ..." # 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 + if mount -F hsfs -o ro "$dfile" "${MOUNTPOINT}" 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 + echo "FATAL: /usr image ($USR) not found" exit 1 fi +lofiadm -a "${MOUNTPOINT}/${USR}" >/dev/null & +for n in 1 2 3 4 5 6 7; do + sleep 1 + devfsadm || true + if [ -e /dev/lofi/1 ]; then + break + fi +done +if [ ! -e /dev/lofi/1 ]; then + echo "FATAL: Loopback device not created" + umount /cdrom + exit 1 +fi -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 +mount -F hsfs -o ro /dev/lofi/1 /usr2 rm -f /usr ln -sf /usr2 /usr diff --git a/protostar b/protostar index 7609fb3..7e6cff4 100755 --- a/protostar +++ b/protostar @@ -2,7 +2,6 @@ set -e set -u -set -x TMP="${TMP:-/var/tmp}" @@ -47,7 +46,7 @@ echo "Preparing base system (debootstrap)..." debootstrap \ --no-check-gpg \ --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 \ + --include=illumos-grub,illumos-kernel,mc,vim-tiny,openssh-client,wget,bzip2,xz-utils,debootstrap,less,file,lynx,bash-completion \ "${DIST}" \ "${ROOT}" \ "${REPO}" @@ -61,10 +60,14 @@ rm -rf "${ROOT}"/var/log/* rm -rf "${ROOT}"/var/adm/* rm -rf "${ROOT}"/usr/share/doc/* +# Remove messages and localized mans: +rm -rf "${ROOT}"/usr/share/locale/*/LC_MESSAGES +rm -rf "${ROOT}"/usr/share/man/*/man[0-9]* + devfsadm -r "${ROOT}" -sed -i '/^PermitRootLogin/ s,no,yes,' /etc/ssh/sshd_config +#sed -i '/^PermitRootLogin/ s,no,yes,' /etc/ssh/sshd_config cat < $ROOT/boot/solaris/bootenv.rc setprop ata-dma-enabled 1 @@ -86,6 +89,7 @@ cat < $ROOT/etc/vfstab #to mount to fsck point type pass at boot options # /devices/ramdisk:a - / ufs 1 no rw,nologging +fd - /dev/fd fd - no - VFSTAB @@ -95,6 +99,7 @@ touch "${ROOT}/etc/dhcp.e1000g0" # Set root password (just "root"): echo 'root:root' | chpasswd -R "$ROOT" +echo 'User: root, password: root' >> "${ROOT}/etc/issue" # Script to find and mount usr.lzma: sed "s/##USR_IMG##/$USR_IMG/g" "fs-root" > "${ROOT}/lib/svc/method/fs-root" @@ -123,6 +128,7 @@ mkdir -p "${BOOTARCH}/usr" mkdir -p "${BOOTARCH}/cdrom" pushd "${ROOT}" + # Move some critical libs: march=`dpkg-architecture -qDEB_HOST_MULTIARCH` mkdir -p lib/$march @@ -157,10 +163,13 @@ ln -sf ../../sbin usr/sbin # and creating symlinks from usr to usr1 usr_symlink_move usr/bin/cat usr_symlink_move usr/bin/dash +usr_symlink_move usr/bin/ln usr_symlink_move usr/bin/ls +usr_symlink_move usr/bin/rm usr_symlink_move usr/bin/sh usr_symlink_move usr/lib/devfsadm -usr_symlink_move usr/lib/fs +usr_symlink_move usr/lib/fs/ufs/mount +usr_symlink_move usr/lib/fs/hsfs/mount # usr2 will be packed and stored on CD: mv usr usr2 @@ -168,6 +177,7 @@ mv usr usr2 # This is usr before usr2 is mounted, # fs-root will mount usr2 and replace usr -> usr2 ln -sf usr1 usr +ln -sf ../../sbin usr1/sbin # List here files or directories which # should be *moved* to boot archive. @@ -251,7 +261,10 @@ timeout=3 splashimage=/boot/grub/splash.xpm.gz foreground=ffffff background=215ECA -title Dyson ($DIST), $DATE +title Dyson ($DIST) LiveCD, $DATE + kernel /platform/i86pc/kernel/amd64/unix + module /boot/boot_archive.gz +title Dyson ($DIST) LiveCD, $DATE - verbose boot kernel /platform/i86pc/kernel/amd64/unix -k -m verbose module /boot/boot_archive.gz GRUB -- cgit v1.2.3