cannot make ISO yet
authorRalph Ronnquist <rrq@rrq.au>
Fri, 8 Mar 2024 13:03:15 +0000 (00:03 +1100)
committerRalph Ronnquist <rrq@rrq.au>
Fri, 8 Mar 2024 13:03:15 +0000 (00:03 +1100)
minbase-strap.sh

index 82cc91a4ab8ec1b218296dd1ee043486f8337612..6f41ac05d5f01bfb1abd9df196e498f034c9e152 100755 (executable)
@@ -47,7 +47,8 @@ if $DEBSTRAP ; then
     ## bootstrap a filesystem, with exclusions
     echo "http_proxy=$http_proxy debootstrap ..."
     debootstrap --exclude=logrotate,cron,cron-daemon-common \
-               --arch=$ARCH $DIST "$FS" http://deb.devuan.org/merged
+               --arch=$ARCH $DIST "$FS" http://deb.devuan.org/merged || \
+       chroot "$FS" apt-get -f install -y
     chroot "$FS" apt-get install -y logrotate cron
 
     ## Select and add a kernel
@@ -78,89 +79,25 @@ else
     exit 1
 fi
 
-#============================================================
-# Prepare a temporary directory tree with a boot kernel and $FS packed
-# up into an initrd.gz
-TMP=$(mktemp -d XXXX)
-trap "rm -r $TMP" 0 2 15
-
-mkdir -p $TMP/prep/{proc,dev,tmp,sys,mnt,usr}
-stupid_links $TMP/prep
-
-# copy FS tree(s) in full into the TMP/prep tree
-copyFStree() {
-    local D
-    for D in $* ; do
-       tar cf - -C "$FS" $D \
-           | tar -xf - --skip-old-files --keep-directory-symlink -C $TMP/prep
-    done
-}
-
-# Copy FS binary(s) with all its libraries into the TMP/prep tree
-copyFSbin() {
-    local B BIN
-    for B in $* ; do
-       BIN="$(chroot "$FS" which "$B")"
-       tar cf - --dereference -C "$FS" ${BIN#/} \
-           $(chroot "$FS" ldd "$BIN" | grep -oE '/[^ ]*'|sed 's|/||')\
-           | tar -xf - --keep-directory-symlink -C $TMP/prep
-    done
-}
-
-INITRD="$FS"/boot/initrd.img${LINUX#*/vmlinuz}
-if [ -r "$INITRD" ] ; then
-    #select X in my FS ; do [ -n "$X" ] && break ; done
-    X=FS
-else
-    X=my
-fi
-case "$X" in
-    FS)
-       copyFStree lib/modules
-       zstdcat $INITRD | ( cd $TMP/prep && cpio -i )
-       VERSION=( $TMP/prep/lib/modules/* )
-       for V in ${VERSION[@]} ; do
-           depmod -a -b $TMP/prep ${V#$TMP/prep/lib/modules/}
-       done
-       ;;
-    my)
-       copyFStree lib/modules lib/udev
-       copyFSbin busybox sh cttyhack setsid mount mkdir
-       copyFSbin udevd udevadm modprobe modinfo kmod blkid
-       ;;
-esac
-
-## (re)install /init
-mv $TMP/prep/init{,.FS}
-echo "** Please select /init template"
-select INIT in none $(echo init*.template) ; do [ -n "$INIT" ] && break ; done
-if [ "$INIT" != none ] ; then
-    cp $INIT $TMP/prep/init
-    chmod a+x $TMP/prep/init
-fi
-
-# Populate $TMP with /initrd.gz. /vmlinuz and /menu.cfg
-( cd "$TMP/prep" && find -printf '%P\n' | cpio -o -H newc ) | \
-    gzip > $TMP/initrd.gz
-cp $LINUX $TMP/vmlinuz
-rm -r $TMP/prep
+. ./minbase-strap-initrd.sh
 
+#============================================================
 # Common syslinux menu
 CON="console=ttyS0,115200"
 cat <<EOF > $TMP/menu.cfg
 default menu.c32
 label rescue (serial)
     kernel /vmlinuz
-    append initrd=/initrd.gz init=/init $CON rescue
+    append initrd=/initrd.img init=/init $CON rescue
 label rescue2 (vt1)
     kernel /vmlinuz
-    append initrd=/initrd.gz init=/init rescue
+    append initrd=/initrd.img init=/init rescue
 label linux2 (sda2)
     kernel /vmlinuz
-    append initrd=/initrd.gz root=/dev/sda2 rootfstype=squashfs $CON
+    append initrd=/initrd.img root=/dev/sda2 rootfstype=squashfs $CON
 label linux (sdb1)
     kernel /vmlinuz
-    append initrd=/initrd.gz root=/dev/sdb1 $CON
+    append initrd=/initrd.img root=/dev/sdb1 $CON
 EOF
 
 . ./minbase-strap-bios.sh
@@ -168,3 +105,5 @@ EOF
 . ./minbase-strap-mkimg.sh
 
 for E in $ENDING ; do $E ; done
+
+#. ./minbase-strap-mkiso.sh $IMG