updated init.in mkinitramfs.sh and added lsinitramfs

This commit is contained in:
wt committed 2025-01-09 10:17:56 +07:00
1 parent ae18f34160
commit fe8e65809a
3 files changed
+56 -20

No files matched your search

Regular → Executable
+38 -18
View File
@@ -1,11 +1,39 @@
#!/bin/sh #!/bin/sh
PATH=/usr/bin:/usr/sbin export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH rootfspath=/.root
init=/sbin/init
root=
rootdelay=
rootfstype=auto
ro="ro"
rootflags=
device=
resume=
noresume=false
#--- colors ---
RESET="\033[0m"
BRED="\033[1;31m"
#--------------
mount_setup() {
mount -t proc proc /proc -o nosuid,noexec,nodev
mount -t sysfs sys /sys -o nosuid,noexec,nodev
mount -t devtmpfs dev /dev -o mode=0755,nosuid
mount -t tmpfs run /run -o nosuid,nodev,mode=0755
}
move_mount_setup() {
mount --move /proc $rootfspath/proc
mount --move /sys $rootfspath/sys
mount --move /dev $rootfspath/dev
mount --move /run $rootfspath/run
}
problem() problem()
{ {
printf "Encountered a problem!\n\nDropping you to a shell.\n\n" printf "[$BRED ERROR $RESET] Encountered a problem!\n\nDropping you to a shell.\n\n"
sh sh
} }
@@ -67,20 +95,11 @@ do_try_resume()
echo -n ${maj%,}:$min > /sys/power/resume ) echo -n ${maj%,}:$min > /sys/power/resume )
} }
init=/sbin/init mount_setup
root= # mount -n -t devtmpfs devtmpfs /dev
rootdelay= # mount -n -t proc proc /proc
rootfstype=auto # mount -n -t sysfs sysfs /sys
ro="ro" # mount -n -t tmpfs tmpfs /run
rootflags=
device=
resume=
noresume=false
mount -n -t devtmpfs devtmpfs /dev
mount -n -t proc proc /proc
mount -n -t sysfs sysfs /sys
mount -n -t tmpfs tmpfs /run
read -r cmdline < /proc/cmdline read -r cmdline < /proc/cmdline
@@ -123,4 +142,5 @@ do_mount_root
killall -w ${UDEVD##*/} killall -w ${UDEVD##*/}
exec switch_root /.root "$init" "$@" exec switch_root $rootfspath "$init" "$@"
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh -e
[ -f /etc/mkinitramfs.conf ] && . /etc/mkinitramfs.conf
[ "$1" ] || exit 1
case $INITFSCOMP in
gzip) compressor="gzip -dc" ;;
lz4) compressor="lz4 -d -c" ;;
cat) compressor="cat --" ;;
xz) compressor="xzcat --" ;;
zstd) compressor="zstd -d -c" ;;
esac
$compressor "$1" | bsdcpio -it
exit 0
Regular → Executable
+2 -2
View File
@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# This file based in part on the mkinitramfs script for the LFS LiveCD
# written by Alexander E. Patrakov and Jeremy Huntwork. export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
copy() copy()
{ {