SFS subtraction

Miscellaneous tools
Post Reply
Message
Author
stemsee

SFS subtraction

#1 Post by stemsee »

I have an apps.sfs and I need to remove an office sfs from it, and create a results sfs. Here is my attempt. Sfs3 should be in /tmp or on a linux partition ext1/2/3/4 reiserfs btrfs f2fs etc

Code: Select all

#!/bin/sh
# sfs1-sfs2=sfs3
# Use this script to mount two sfs files and ignorantly create a third
# sfs file. Mount sfs1 which contains the files and more as in sfs2, then copy
# the files from sfs1 to a directory for sfs3, only if those files do not exist in
# sfs2.
Version=1
on=`ps -e | grep sfseparator.sh | wc -l`
[[ "$on" -gt 2 ]] && exit #check if running, one instance only
echo "Input path/sfs1 and path/sfs2 and output path/sfs3 directory
eg /mnt/sda1/fd64.sfs /mnt/sda1/fd1/fd64.sfs /mnt/mmcblk2p2/rm/fd64"
read one two three

echo "$one $two $three" > /tmp/paths
rm -rf $three
rm -f $three.sfs
mkdir -p /tmp/one
mkdir -p /tmp/two
umount -f /tmp/one
umount -f /tmp/two
umount -f $one
umount -f $two
mount -loop -t squashfs $one /tmp/one
mount -loop -t squashfs $two /tmp/two

rsync -av --progress --stats --compare-dest=/tmp/two/ /tmp/one/  $three/
sync
mksquashfs $three $three.sfs -comp xz
umount /tmp/one
umount /tmp/two
Last edited by stemsee on Wed 26 Dec 2018, 23:27, edited 1 time in total.

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

#2 Post by mikeslr »

Not that I know enough about coding to be of any help, but:

From your post I can't tell if you were successful [and the post should have been in the "How to" Section] or unsuccessful [and the post should have been in the 'Programming Section" or "User's Section" with some information about what went wrong.

Having little knowledge of coding, I would have just mounted the SFS, copied it to a folder, deleted LibreOffice from /opt and its desktop from /usr/share/applications. Maybe with the original SFS loaded, used pfind to locate any other files/folders --such as those which may be in /usr/bin-- for deletion. Before loading the new SFS, I would have deleted the /root/.config/libreoffice folder. I wouldn't bother with deleting jpgs/pngs etc. Then dir2sfs the folder.

But then, I wouldn't have included LibreOffice in the first place. It updates too often, and surprisingly the recent updates have made it better --less RAM hungry.

By the way, Libreoffice doesn't cleanly unload. I recently upgraded from using a 6.0 SFS to a 6.1 SFS. I ran pfind while writing this post and discovered a 6.0 folder in /opt with some sub-folders (all otherwise empty) and some broken symlinks to 6.0 icons remaining in /var/local.

stemsee

#3 Post by stemsee »

Hi mike

Interesting scenario. I said Office (not which office, libre or wps for eg
) but it could have been Wifi-TrayNet.sfs or chrome.sfs. TIhe actual use for me is that I am using fatdog on a 2gb ram atom pc. I have Ardour, Flowblade, AnyDesk, FKTranskript, PDFeditor-4.0, Wifi-TrayNet and other smaller sfs modules in one 'apps'.sfs @ 695mb. Which I can load on most systems, no searching around for individual modules. For some reason I had to remove one package, and I tried to use this script .... tried and succeeded!

It is a working script which provides a utility, not a how to.

I am pretty sure it is in the most appropriate place!

regards
stemsee

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

#4 Post by mikeslr »

Hi stemsee,

As I said "Not that I know enough about coding". But you're right. As a script which works and should prove useful, it's appropriately located in "Utilities". :)

Post Reply