You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
#!/bin/bash |
|
#remaster lib |
|
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; } |
|
|
|
#filesystem_extract [filesystem_img_source] [chroot_path] |
|
function filesystem_extract() { |
|
echo "extract filesystem ..." |
|
|
|
#$1 = filesystem_img_source |
|
#$2 = chroot_path |
|
filesystem_img_source="$1" |
|
chroot_path="$2" |
|
filesystem_log="`mktemp`" |
|
|
|
#Überfrüfen der Parameter |
|
[ -f "$filesystem_img_source" ] || { |
|
echo "### ERROR ### filesystem_extract: squashfs \"$filesystem_img_source\" not exist!" |
|
return 11 |
|
} |
|
|
|
[ "`mkdir -p "$chroot_path"`" != "" ] && { |
|
echo "### ERROR ### filesystem_extract: chroot_path \"$chroot_path\" can't create!" |
|
return 13 |
|
} |
|
|
|
[ "`filesystem_get_type $chroot_path`" != "ext4" ] && [ "`filesystem_get_type $chroot_path`" != "btrfs" ] && { |
|
echo "### ERROR ### filesystem_extract: wrong filesystem (`filesystem_get_type $chroot_path`)!" |
|
return 22 |
|
} |
|
|
|
rm -r "$chroot_path" |
|
|
|
#eigendliches entpacken |
|
unsquashfs -d "$chroot_path" "$filesystem_img_source" > "$filesystem_log" || { |
|
echo "### ERROR ### filesystem_extract: unsquashfs failed!" |
|
return 14 |
|
} |
|
|
|
grep -v "\[" "$filesystem_log" |
|
rm "$filesystem_log" |
|
|
|
echo "done" |
|
} |
|
|
|
#this func is standalone executable |
|
[ -n "$1" ] && { |
|
filesystem_extract $@ |
|
}
|
|
|