#!/bin/bash
#input_method=1
rm ./sandbox.out #For now I don't want to use the previous config.
SB_PREFIX=$(realpath ./psandbox)
OS_HOME=$(realpath .)
PSUBDIR=${OS_HOME#/mnt/*/}
MP=${OS_HOME%"$PSUBDIR"}
mkdir -p "$MP"
#OS_HOME="$MP/$PSUBDIR"
LOGFILE="$OS_HOME/sandbox.log" #don't use realpath because busybox doesn't support the -m option.
#B1_source="/aufs/devsave/Dropbox (Maestral)/s243a Personal"
#B1_target=/Remote/jobs #Sometimes I might get this folder via samaba isntead of a bind.
#B1_source=/samba
#B1_target=/samba
#rev_B1_source=/
#rev_B1_target='$FAKEROOT/samba'
#if [ -f ./sandbox.out ]; then
# bash -x "$SB_PREFIX"/usr/bin/psandbox.sh --logfile "$LOGFILE" -f "$OS_HOME"/sandbox.out -o "$OS_HOME"/sandbox.out --pdrv #"$MP" --maybe-psubdir "$PSUBDIR" -e "devx_fossapup64_9.5.sfs" --no-exit --rw-layer "$RW_LAYER" --copy-Xauth --bind-X11-#sockets --copy-resolv_conf --bind "$B1_source" "$B1_target"
#
#else
#bash -x "$SB_PREFIX"/usr/bin/psandbox.sh --trace --logfile "$LOGFILE" -o "$OS_HOME"/sandbox.out --pdrv "$MP" --maybe-psubdir "$PSUBDIR" -e "devx_fossapup64_9.5.sfs" --no-exit --rw-layer "$RW_LAYER" --copy-Xauth --bind-X11-sockets --copy-resolv_conf --rev_bind "$B1_source"--rev_bind "$B1_target" --bind "$B1_source" --bind "$B1_target" ----before-chroot "/etc/init.d/rc.samba start || /etc/init.d/rc.samba restart"
#don't use --no-exit --copy-Xauth for now.
# bash -x "$SB_PREFIX"/usr/bin/psandbox2.sh --trace --logfile "$LOGFILE" -o "$OS_HOME"/sandbox.out --pdrv "$MP" --maybe-psubdir "$PSUBDIR" --no-exit --rw-layer "$RW_LAYER" --bind-X11-sockets --copy-resolv_conf --rev_bind "$B1_source" --rev_bind "$B1_target" --bind "$B1_source" --bind "$B1_target" --before-chroot "/etc/init.d/rc.samba start || /etc/init.d/rc.samba restart"
if [ -z "$input_method" ]; then
echo "Select the layring method:
1. Merge Components into "'"/"'". Using Hardlinks since Creasting symlink /cont -> / doesn't accomplish this.
2. Symlink cont dirs. E.g. Creates /bin -> /cont/bin
3. Sylink component files into "'/'". This is a tinycore-like approach
4. None, Use save file to handle symlink creation
5. Use Simplified Iron Chroot Script
6. Start Iron as Portable Browser"
read input_method
fi
case "$input_method" in
1|2|3)
RW_LAYER="$OS_HOME/savefiles/slackosave_$input_method"
;;
5)
COMMAND=( bash -x "$OS_HOME/iron_scripts/ironchroot" --chroot-command ./iron )
;;
6)
COMMAND=( bash -x "$OS_HOME/iron_scripts/ironchroot" --command ./iron )
;;
*)
RW_LAYER="$OS_HOME/savefiles/slackosave_test1"
;;
esac
mkdir -p "$RW_LAYER"
case "$input_method" in
1)
MERGE_LAYER=./symlinks/merge_components
SYMLINK_LAYER="$(realpath $MERGE_LAYER)"
;;
2)
SYMLINK_LAYER="./symlinks/symlink_cont_dirs"
SYMLINK_LAYER="$(realpath $MERGE_LAYER)"
;;
3)
SYMLINK_LAYER="./symlinks/symlink_cont_dirs"
SYMLINK_LAYER="$(realpath $MERGE_LAYER)"
;;
esac
case "$input_method" in
2|3)
SYMLINK_LAYER="$(realpath $MERGE_LAYER)"
;;
esac
case "$input_method" in
1|2|3)
merge_layer=./
"$SB_PREFIX"/usr/bin/psandbox2.sh --trace --logfile "$LOGFILE" -o "$OS_HOME"/sandbox.out --pdrv "$MP" \
--layer "$SYMLINK_LAYER" \
--maybe-psubdir "$PSUBDIR" --no-exit \
--rw-layer "$RW_LAYER" --bind-X11-sockets --copy-resolv_conf
;;
5|6)
"${COMMAND[@]}"
;;
*)
"$SB_PREFIX"/usr/bin/psandbox2.sh --trace --logfile "$LOGFILE" -o "$OS_HOME"/sandbox.out --pdrv "$MP" --maybe-psubdir "$PSUBDIR" --no-exit \
--rw-layer "$RW_LAYER" --bind-X11-sockets --copy-resolv_conf
;;
esac
Comments