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