#!/bin/bash CWD="$PWD" clean=true OVERWRITE_TARGET=yes USE_NON_FULL_VERSIONS=yes USE_BB_FOR_nonFULL=yes FULL_UTILS=(tar realpath) HARDLINKED_SFS_unextracted="$(realpath ../puppy_upupgg+d_20.10.sfs)" EXTRACTED_SFS=puppy_upupgg+d_20.10.sfs.extracted NEW_SFS=puli7.3_x86_64-ungoogled-hardlinked-new.sfs FR_SOURCE_ARCHIVE="$(realpath ../kalipup_CLI_0.0002.sfs)" FR_SOURCE_ORIG="$(realpath ./chroot-kali-rolling-i386.extracted)" [ "$clean" = true ] && rm -rf "$EXTRACTED_SFS" EXTRACTED_SFS_FP="$CWD"/"$EXTRACTED_SFS" FR_SOURCE="$CWD"/"$EXTRACTED_SFS"/kali/cli if [ ! -d $EXTRACTED_SFS ] || [ ! "$(ls -A $EXTRACTED_SFS)" ] ; then #mkdir -p "$EXTRACTED_SFS" uextract -o . $HARDLINKED_SFS_unextracted || { echo "failed to extract $HARDLINKED_SFS_unextracted" && exit; } if [[ "$(basename ${HARDLINKED_SFS_unextracted}.extracted)" != "$EXTRACTED_SFS" ]]; then mv ${HARDLINKED_SFS_unextracted}.extracted $EXTRACTED_SFS fi fi EXTRACTED_SFS="$(realpath "$EXTRACTED_SFS")" || { echo "failed realpath \"$HARDLINKED_SFS\"" && exit; } TARGET="$EXTRACTED_SFS"/kali; mkdir -p "$TARGET" #See: https://forum.puppylinux.com/viewtopic.php?f=53&t=1397&p=15016&hilit=hardlinked#p15016 HL_LOC="$EXTRACTED_SFS"; mkdir -p "$HL_LOC" USE_MULTI_ARCH_DIRS=yes WARN_MV_ARCH=true [ ! -d "$TARGET" ] && mkdir -p "$TARGET" [ ! "$(ls -A "$TARGET")" ] && rsync -rltDv --exclude /kali --link-dest="${HL_LOC}/" "${HL_LOC}/" "${TARGET}/" MV_LOC="$TARGET/GG-moved"; mkdir -p $MV_LOC #set +x #read -p "press enter to continue" #set -x if [ ! -d "$FR_SOURCE_ORIG" ]; then uextract -o "$FR_SOURCE_ORIG" "$FR_SOURCE_ARCHIVE" || { echo "failed to extract $HARDLINKED_SFS_unextracted" && exit; } fi if [ ! -d "$FR_SOURCE_ORIG" ]; then cp -Ra "$FR_SOURCE_ORIG" "$FR_SOURCE" fi if [ ! -d "$FR_SOURCE" ]; then cp -Ra "$FR_SOURCE_ORIG" "$FR_SOURCE" fi CHROOT_DIR="$TARGET" ./remove_builtin.sh --pkg-list uninstallsfs "TARGET" #FR_SOURCE=/mnt/+mnt+sda5+test_save+ext2/firstRIB_lego/01firstrib_rootfs.sfs.extracted #Move no longer needed core libs #if [ "$USE_MULTI_ARCH_DIRS" = yes ]; then #while read arch_dir_rel; do #target_arch_dir="$TARGET/$arch_dir_rel" #arch_dir="$(basename "$arch_dir_rel")" #parent_dir_rel="$(dirname "${arch_dir_rel}")" #target_arch_parent="$TARGET/$parent_dir_rel" #parent_of_arch_dir="$TARGET/$parent_dir_rel" #fp_arch_dir="$parrent_dir/arch_dir" ##if [ ! -d "$target_arch_dir" ]; then ##source_dir="$FR_SOURCE/$a_dir" #source_arch_dir="$FR_SOURCE/$arch_dir_rel" #if [ ! -d "$source_arch_dir" ]; then #[ -e "$target_arch_dir" ] && rm "$target_arch_dir" ; #mkdir -p "$target_arch_dir" #else ##the read in this warn section causes the outer loop to be skipped so comment out until fixed. ##if [ "$WARN_MV_ARCH" = true ]; then #Debugging code ##set +x ##echo "about to:" ##echo " ##cd \"$FR_SOURCE\" ##echo ./\"${arch_dir_rel}\" | \ ##cpio -pdu \"$TARGET\" )" ##read -p "Press enter to continue" ##set -x ##fi #( cd "$FR_SOURCE" #echo "./${arch_dir_rel}" | \ #cpio -pdu "$TARGET" ) #fi ##fi #while read b_name; do ##the read in this warn section causes the outer loop to be skipped so comment out until fixed. ##if [ "$WARN_MV_ARCH" = true ]; then #Debugging code ##set +x ##echo "about to:" ##echo " ##mv \"$target_arch_parent/$b_name\" \"$target_arch_dir/$b_name\" ##( cd \"$target_arch_parent\"; ln -s \"$b_name\" \"$arch_dir/$b_name\" ) " ##read -p "Press enter to continue" ##set -x ##fi #rel_path="$(dirname "$arch_dir_rel")/$b_name" #case "$rel_path" in #lib/lsb|lib/systemd|lib/terminfo) continue; ;; #usr/lib/apt|usr/lib/debootstrap|usr/lib/dpkg) continue; ;; #usr/lib/locale|usr/lib/mime|usr/lib/NetworkManager) continue; ;; #usr/lib/pm-utils|usr/lib/ssl|usr/lib/tmpfiles.d) continue; ;; #esac #[[ "$target_arch_parent/$b_name" = "$target_arch_dir" ]] && continue #mv "$target_arch_parent/$b_name" "$target_arch_dir/$b_name" #( cd "$target_arch_parent"; ln -s "$arch_dir/$b_name" "$b_name" ) #done < <(find $target_arch_parent -mindepth 1 -maxdepth 1 -type d | xargs -n 1 basename) #done <> "$TARGET/etc/ld.so.conf" export $PATH="$PATH":/usr/local/firstrib/bin >> /etc/profile #maybe do this in /root/.profile while read a_file; do cp -af "$FR_SOURCE/etc/$a_file" "$TARGET/etc/$a_file" done < /etc/profile cd "$CWD" ./sync_file_lists.sh #mksquashfs "$EXTRACTED_SFS" "$NEW_SFS"