remaster/src/func/filesystem_pack

38 lines
847 B
Bash
Executable File

#!/bin/bash
#remaster lib
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }
#filesystem_pack [chroot_path] [filesystem_img_destination]
function filesystem_pack() {
echo "pack filesystem ..."
#$1 = chroot_path
#$2 = filesystem_img_destination
chroot_path="$1"
filesystem_img_destination="$2"
filesystem_log="`mktemp`"
#Überfrüfen der Parameter
[ -d "$chroot_path" ] || {
echo "### ERROR ### filesystem_extract: chroot_path \"$chroot_path\" not exist!"
return 12
}
#loslegen ...
rm -f "$filesystem_img_destination"
mksquashfs "$chroot_path" "$filesystem_img_destination" > "$filesystem_log" || {
echo "### ERROR ### filesystem_pack: mksquashfs failed!"
return 13
}
grep -v "\[" "$filesystem_log"
rm "$filesystem_log"
echo "done"
}
#this func is standalone executable
[ -n "$1" ] && {
filesystem_pack $@
}