updated mkinitramfs.sh and lsinitramfs

This commit is contained in:
wt committed 2025-01-09 12:09:02 +07:00
1 parent 55b0c4149e
commit 1cede8e014
2 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
[ "$1" ] || exit 1
case $INITFSCOMP in
case $INITRAMFSCOMP in
gzip) compressor="gzip -dc" ;;
lz4) compressor="lz4 -d -c" ;;
cat) compressor="cat --" ;;
+4 -3
View File
@@ -1,21 +1,22 @@
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
initdir=./initramfs
initdir=$(pwd)/initramfs
create_dirs() {
mkdir -pv $initdir/{bin,dev,mnt,proc,root,sys,run}
}
main() {
CPIO=$(command -v cpio)
create_dirs
cp -v /usr/share/mkinitramfs/init.in $initdir/init
chmod 755 $initdir/init
cp -v /usr/share/mkinitramfs/busybox $initdir/bin/busybox
cd $initdir/bin
for i in $(cat /usr/share/mkinitramfs/busybox_list);do ln -sv busybox $i;done
cd ..
find . | cpio -H newc -o | gzip > ../initramfs.img
cd $initdir
find . | $CPIO -H newc -o | gzip > ../initramfs.img
cd ..
rm -rv $initdir
}