This commit is contained in:
Your Name 2024-07-29 20:12:32 -06:00
parent a2ceb9978c
commit 40ee7314c2

View File

@ -155,21 +155,37 @@ os-backup() {
cryptsetup close $ROOT_MAPPER_NAME
}
live-os-userData() {
clear
mkdir /tmp/live
LIVE_OS_DM="/dev/mapper/$(mount | grep -i ' / ' | cut -d '/' -f4 | cut -d ' ' -f1)"
LIVE_OS_SUBVOL="@$(mount | grep -i ' / ' | cut -d '@' -f2 | sed 's/)//g')"
partitions
mount $LIVE_OS_DM /tmp/live
clear
echo "[Syncing User Data to from $LIVE_OS_DM to $HARD_DISK ]"
echo
userTweaks
chown -R $USER:$USER $TARGET/home/$USER
cd
umount /tmp/live
}
live-os-restore() {
clear
mkdir /tmp/live
LIVE_OS_DM="/dev/mapper/$(mount | grep -i ' / ' | cut -d '/' -f4 | cut -d ' ' -f1)"
LIVE_OS_SUBVOL="@$(mount | grep -i ' / ' | cut -d '@' -f2 | sed 's/)//g')"
partitions
clear
mount $LIVE_OS_DM /tmp/live
clear
echo "[Transferring Currenting Running OS from $LIVE_OS_DM to $HARD_DISK ]"
echo
LIVE_OS_DM="/dev/mapper/$(mount | grep -i ' / ' | cut -d '/' -f4 | cut -d ' ' -f1)"
LIVE_OS_SUBVOL="@$(mount | grep -i ' / ' | cut -d '@' -f2 | sed 's/)//g')"
mount $LIVE_OS_DM /tmp/live
cd /tmp/live/$LIVE_OS_SUBVOL
rsync -a --delete . --exclude=home/* --exclude=sys/* --exclude=dev/* --exclude=proc/* --exclude=run/* $TARGET/
fstab
cp -f $SCRIPT/debian.sh $TARGET/usr/bin/
systemMounts
@ -177,12 +193,13 @@ live-os-restore() {
echo
rm -f $TARGET/boot/*
rsync -av --delete /boot/ $TARGET/boot/
chmod +x $TARGET/usr/bin/debian.sh
chroot $TARGET /usr/bin/debian.sh bootloader $1 $5 $2
chroot $TARGET /usr/bin/debian.sh btrfs-tweaks
chroot $TARGET /usr/bin/debian.sh accounts
read -p 'Would you like to run your UserTweaks? :' -e -i 'y' user_tweaks
read -p 'Would you like to run your UserTweaks? :' -e -i 'y' user_tweaks
if [[ $user_tweaks = *y* ]]; then
userTweaks
else
@ -737,6 +754,7 @@ tweaks() {
echo "[4] Chroot into existing OS"
echo "[5] *Danger* Resize /boot and /boot/efi [Run on booted OS only!]"
echo "[6] Restore Current Running OS to Another Drive"
echo "[7] Re-sync User data to Live Medium from Step 6"
echo
read -p 'Your Choice: ' choice
if [[ $choice = 1 ]]; then
@ -791,6 +809,9 @@ tweaks() {
elif [[ $choice = 6 ]]; then
set-devices
live-os-restore "$HARD_DISK" $ROOT_MAPPER_NAME "none" "none" "$ROOT_NAME"
elif [[ $choice = 7 ]]; then
set-devices
live-os-userData
fi
}