-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add initramfs_pack and initramfs_unpack to copied files to the live OS
- Loading branch information
Showing
4 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
Slax/slackware15/modules/01-core/rootcopy/usr/bin/initramfs_pack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ "$1" = "-h" -o "$1" = "--help" -o "$1" = "" ]; then | ||
echo "" | ||
echo "Create initramfs image from a tmpfs-mounted directory tree" | ||
echo "Usage: $0 [source_directory]" | ||
echo "" | ||
exit 2 | ||
fi | ||
|
||
IMG="$(readlink -f "$1")" | ||
touch "$IMG.2" # ends if error | ||
|
||
(cd "$IMG"; find . -print | cpio -o -H newc 2>/dev/null) | xz -T0 -f --extreme --check=crc32 >"$IMG.2" | ||
umount "$IMG" | ||
rmdir "$IMG" | ||
mv "$IMG.2" "$IMG" |
20 changes: 20 additions & 0 deletions
20
Slax/slackware15/modules/01-core/rootcopy/usr/bin/initramfs_unpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ "$1" = "-h" -o "$1" = "--help" -o "$1" = "" ]; then | ||
echo "" | ||
echo "Unpack initramfs image so it becomes a directory" | ||
echo "Usage: $0 [source_initramfs_file.img]" | ||
echo "" | ||
exit 2 | ||
fi | ||
|
||
IMG="$(readlink -f "$1")" | ||
|
||
mv "$IMG" "$IMG.2" | ||
mkdir -p "$IMG" | ||
mount -t tmpfs tmpfs "$IMG" | ||
|
||
(cd "$IMG"; xz -d | cpio -idv >/dev/null 2>&1) < "$IMG.2" | ||
rm "$IMG.2" |