My query is simple: Is there a way i could make an sb file with selected folders?
like makesb -d /usr/... / /opt/...
Code: Select all
export ENV_MODULES_DIR="/mnt/home/15alphaos64/modules"
function sq-session() {
local back_dir="$PWD"
local name="$1"
local default_str="etc,root,usr"
read -p "Enter comma separated list of top dirs to save: " str
[ -z "$str" ] && str="$default_str"
echo "Commencing save of $str ..."
TEMPDIR=$(mktemp -d -q)
builtin cd /mnt/live/memory/changes
eval cp -r {$str} $TEMPDIR
builtin cd /tmp
[ -z "$name" ] && name="saved_ram-`date +%Y%m%d%H%M`"
mksquashfs "$TEMPDIR" "${name}.sb" -noappend -comp xz -Xbcj x86 -Xdict-size 100% -b 1M
echo -e "\nMoving squash: "${name}.sb" to $ENV_MODULES_DIR"
mv "${name}.sb" "$ENV_MODULES_DIR"
builtin cd "$back_dir"
echo "done"
}
function sq-file() {
local file=`realpath "$1"`
local name="$2"
if [ -z "$name" ]; then name="${1##*/}"; fi
if [ -z "$name" ]; then name="${1%/}"; fi
echo "Commencing squashify of $file ..."
TEMPDIR=$(mktemp -d -q)
cp -r --parents "$file" "$TEMPDIR"
mksquashfs "$TEMPDIR" "${name}.sb" -noappend -comp xz -Xbcj x86 -Xdict-size 100% -b 1M
echo "Moving squash: "${name}.sb" to $ENV_MODULES_DIR"
mv "${name}.sb" "$ENV_MODULES_DIR"
echo "done"
}
Code: Select all
> ./sq --help
Usage:
sq [OPTION]... [FILES]...
-h, --help display usage message.
-v, --version display script version.
-s, --set-modules-dir Set path to your own
modules directory
It defaults to:
/mnt/home/alphaos/modules
if you want to squash some of the top directories
in RAM then supply only one argument which is the
name of the resulting module without .sb ending
if two arguments are supplied the first is the
name of file or directory to be squashed the
second is the name of resulting bundle without
.sb ending
OBS! naming matters since it controls in what
order modules are loaded during boot. I
use numbers in front where 9 will be
loaded before 8
Examples:
sq 2222222RAM_SAVED
sq /root/.start 1111111start
sq --set-modules-dir /mnt/home/alphaos/modules
Code: Select all
sq --set-modules-dir /mnt/home/alphaos/modules
Code: Select all
sq /opt/game-develop /usr/share/game-develop/
Code: Select all
mkdir /tmp/game_develop
Code: Select all
cp -r --parents /usr/gamedevelop /tmp/game_develop
cp -r --parents /opt/gamedevelop /tmp/game_develop
Code: Select all
mksquashfs /tmp/game_develop game_develop_by_disco_duck.sb -noappend -comp xz -Xbcj x86 -Xdict-size 100% -b 1M
Code: Select all
mkdir /mnt/test
mount game_develop_by_disco_duck.sb /mnt/test
ls /mnt/test
ducklin5 wrote:what if i want to include multiple directories, it doesnt work with a space or a commaCode: Select all
sq /opt/game-develop /usr/share/game-develop/
Return to “General Discussion”
Users browsing this forum: No registered users and 10 guests