Advertisement
s243a

extract_non_kernalFiles_fm_sfs.sh

Mar 31st, 2019
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.39 KB | None | 0 0
  1. #!/bin/sh
  2. extract_non_kernal_files_fm_sfs(){
  3.   select_pup_img() ISO_IMG
  4.   ISO_IMG=$1
  5.  
  6.   echo "Mounting $(basename $ISO_IMG)..."
  7.  
  8.   mount -o ro $IMGPUP /mnt/wktaz
  9.   #mount $IMGPUP /mnt/wktaz -o loop
  10.  
  11.  
  12.   if [ $? -ne 0 ]; then
  13.     echo "Mounting puppy image failed"
  14.     exit
  15.   fi
  16.  
  17.   rootfslist="$(find /mnt/wktaz -type f -name "*.sfs")"
  18.  
  19.   if [ "$rootfslist" == "" ]; then
  20.     echo "Not a puppy disc image"
  21.     umount /mnt/wktaz
  22.     #exit
  23.     return 1 #In bash non zero return values are failures.  
  24.   fi
  25.  
  26.   echo "Copying puppy non-kernel files...."
  27.  
  28.   echo "Searching for non-kernel modules..."
  29.  
  30.   mkdir -p $curdir/kernel-modules/lib
  31.  
  32.   for file1 in $(find /mnt/wktaz -type f -name "*.sfs")
  33.   do
  34.  
  35.   mount -t squashfs $file1 /mnt/wksfs
  36.  
  37.   if [ $? -eq 0 ]; then
  38.  
  39.     if [ -d /mnt/wksfs/lib/modules ]; then
  40.       echo "Copying kernel modules from $(basename $file1) to rootfs..."
  41. sdfgfsdgf pepp  
  42.      
  43.       xcurdir="$(echo "$curdir" | sed "s#\/#\\\/#g")"
  44.      
  45.       find $curdir/kernel-modules/lib/ -type f -name "*" | sed -e "s#$xcurdir\/kernel-modules\/lib\/#\/lib\/#g" > $curdir/kernel-modules/var/lib/tazpkg/installed/linux-modules/files.list
  46.      
  47.     fi
  48.    
  49.     if [ -d /mnt/wksfs/etc/modules ]; then
  50.       cp -rf /mnt/wksfs/etc/modules $curdir/kernel-modules/etc/
  51.     fi
  52.        
  53.     umount /mnt/wksfs
  54.   fi
  55.  
  56.   done
  57.   re_extract_kernal=0 #Added by s243a
  58.   umount /mnt/wktaz
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement