cleanup tmp file structure
This commit is contained in:
parent
56ca407ad9
commit
8b68c136b8
|
@ -5,9 +5,15 @@ SIZE=10000
|
||||||
HOSTNAME=localhost
|
HOSTNAME=localhost
|
||||||
RELEASE=unstable
|
RELEASE=unstable
|
||||||
|
|
||||||
TMP_DIR=$PWD
|
TMP_DIR=${TMP_DIR:=$PWD}
|
||||||
|
|
||||||
MNT_DIR=$TMP_DIR/newroot
|
MNT_DIR=$TMP_DIR/newroot
|
||||||
RESULT_DIR=${RESULT_DIR:=$TMP_DIR/files}
|
INITRD_DIR=$TMP_DIR/initramfs
|
||||||
|
RESULT_DIR=$TMP_DIR/files
|
||||||
|
|
||||||
|
[[ -d $MNT_DIR ]] || mkdir -p $MNT_DIR
|
||||||
|
[[ -d $INITRD_DIR ]] || mkdir -p $INITRD_DIR
|
||||||
|
[[ -d $RESULT_DIR ]] || mkdir -p $RESULT_DIR
|
||||||
|
|
||||||
|
|
||||||
# Configs overwritable via environment variables
|
# Configs overwritable via environment variables
|
||||||
|
@ -29,7 +35,6 @@ cancel() {
|
||||||
|
|
||||||
trap cancel INT
|
trap cancel INT
|
||||||
|
|
||||||
mkdir $MNT_DIR
|
|
||||||
|
|
||||||
|
|
||||||
if [ $FLAVOUR == "debian" ]; then
|
if [ $FLAVOUR == "debian" ]; then
|
||||||
|
@ -156,11 +161,11 @@ chroot $MNT_DIR systemctl enable start-me-up || fail "failed to enable start-me-
|
||||||
##################
|
##################
|
||||||
|
|
||||||
|
|
||||||
mkdir -p $TMP_DIR/initramfs/bin
|
mkdir -p $INITRD_DIR/bin
|
||||||
wget -O $TMP_DIR/initramfs/bin/busybox https://www.busybox.net/downloads/binaries/1.26.1-defconfig-multiarch/busybox-x86_64
|
wget -O $INITRD_DIR/bin/busybox https://www.busybox.net/downloads/binaries/1.26.1-defconfig-multiarch/busybox-x86_64
|
||||||
chmod +x $TMP_DIR/initramfs/bin/busybox
|
chmod +x $INITRD_DIR/bin/busybox
|
||||||
|
|
||||||
cat <<-"EOF" >$TMP_DIR/initramfs/init
|
cat <<-"EOF" >$INITRD_DIR/init
|
||||||
#!/bin/busybox sh
|
#!/bin/busybox sh
|
||||||
|
|
||||||
# Dump to sh if something fails
|
# Dump to sh if something fails
|
||||||
|
@ -202,12 +207,12 @@ cat <<-"EOF" >$TMP_DIR/initramfs/init
|
||||||
exec switch_root /newroot /sbin/init || error
|
exec switch_root /newroot /sbin/init || error
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x $TMP_DIR/initramfs/init
|
chmod +x $INITRD_DIR/init
|
||||||
|
|
||||||
tar -cJf $TMP_DIR/initramfs/rootfs.tar.xz -C $TMP_DIR/newroot .
|
tar -cJf $INITRD_DIR/rootfs.tar.xz -C $MNT_DIR .
|
||||||
|
|
||||||
cp $TMP_DIR/newroot/boot/vmlinuz-* $RESULT_DIR/vmlinuz
|
cp $MNT_DIR/boot/vmlinuz-* $RESULT_DIR/vmlinuz
|
||||||
cd $TMP_DIR/initramfs
|
cd $INITRD_DIR
|
||||||
find . -print0 | cpio --null -ov --format=newc | gzip -9 > $RESULT_DIR/initramfs.gz
|
find . -print0 | cpio --null -ov --format=newc | gzip -9 > $RESULT_DIR/initramfs.gz
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue