#!/bin/sh # test we are root if [ "$(id -u)" != "0" ]; then exit 1 fi export CFLAGS="-mtune=generic -Os -pipe" export CXXFLAGS="-mtune=generic -Os -pipe -fno-exceptions -fno-rtti " P=fsarchiver V=0.8.8 SRC=$P-$V USER=`cat /etc/sysconfig/tcuser` LIST="compiletc submitqc liblzma-dev zstd-dev libgcrypt-dev bzip2-dev" for Z in $LIST do su -c "tce-load -i $Z" $USER done cd /tmp su -c "/usr/local/bin/wget -nc --no-check-certificate \ https://github.com/fdupoux/$P/releases/download/$V/$SRC.tar.gz" $USER tar xvf $SRC*gz cd $SRC ./configure --prefix=/usr/local --sbindir=/usr/local/bin --disable-lzo --disable-lz4 make -j4 # seconds make install-strip DESTDIR=/tmp/$P cd /tmp # doc ######### mkdir -p $P-doc/usr/local/share mv $P/usr/local/share/man $P-doc/usr/local/share # main ###### mkdir -p $P/usr/local/share/doc/$P echo 'GPL v 2 ' > $P/usr/local/share/doc/$P/COPYING # TCZ them ####### LIST="$P $P-doc " for Z in $LIST do mksquashfs $Z $Z.tcz md5sum $Z.tcz > $Z.tcz.md5.txt cd $Z find . -not -type d | cut -c 2- | sort > /tmp/$Z.tcz.list cd /tmp done ls -hal echo 'Title: fsarchiver-doc.tcz Description: man page Version: 0.8.8 Author: Francois Dupoux Original-site: https://github.com/fdupoux/fsarchiver/ Copying-policy: GPL v 2 Size: 4.0K Extension_by: aus9 @linuxquestions.org Tags: partition imager image compression Comments: Has lots of examples in man page Change-log: 2025/01/16 v 0.8.8 on 15x Current: 2025/01/16 ' > $P-doc.tcz.info echo 'man-db.tcz' > $P-doc.tcz.dep echo 'Title: fsarchiver.tcz Description: partition image tool somewhat similar to partimage Version: 0.8.8 Author: Francois Dupoux Original-site: https://github.com/fdupoux/fsarchiver/ Copying-policy: GPL v 2 Size: 108K Extension_by: aus9 @linuxquestions.org Tags: partition imager image compression Comments: Compares fsarchiver to partimage https://www.fsarchiver.org/partimage/ I have enabled only lzma & zstd compressors To save OR restore partition(s), target partition(s) --- best be unmounted. Considered safe for EXT4, XFS unstable for NTFS. Below I use the -a switch which claims ignores support for xattr and acl as they will not be preserved. fsarchiver counts partitions in image files from zero. My way differs somewhat to man pages. $ sudo su Use mount tool to mount sda4 (where I write image to) Use mount tool to unmount partitions to image/restore # cd /mnt/sda4 To save current partition image for one patition, second line for 2xpartititons # fsarchiver savefs 1.fsa /dev/sda1 -a # fsarchiver savefs 2.fsa /dev/sda1 /dev/sda3 -a To restore a saved image to an existing partition - over writes all data Top line single restore, bottom 2 lines to restore 2 partitions # fsarchiver restfs /z/1.fsa id=0,dest=/dev/sda1 # fsarchiver restfs /z/2.fsa id=0,dest=/dev/sda1 # fsarchiver restfs /z/2.fsa id=1,dest=/dev/sda3 Please see the man page for examples including splitting, encrypting etc Change-log: 2025/01/16 v 0.8.8 on 15x Current: 2025/01/16 ' > $P.tcz.info readelf -d $P/usr/local/bin/$P | grep 'NEEDED' # excluding known rootfs files #liblzma.so.5]liblzma -> zstd #libext2fs.so.2] #libcom_err.so.2] libe2p.so.2]libblkid.so.1] #libuuid.so.1] rootfs #libbz2.so.1.0] bzip2-lib #libzstd.so.1]zstd #libgcrypt.so.20]libgpg-error.so.0] libgcrypt echo 'zstd.tcz bzip2-lib.tcz libgcrypt.tcz ' > $P.tcz.dep submitqc --libs rm -rf *.zsync