mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2025-02-22 00:55:11 +00:00
updated wording and add prompts for actions
This commit is contained in:
parent
64b8a4fb86
commit
6c1572dfe9
|
@ -16,11 +16,11 @@ checkFs() {
|
||||||
|
|
||||||
# Install Btrfs-Assistant/snapper and dependencies
|
# Install Btrfs-Assistant/snapper and dependencies
|
||||||
installBtrfsStack() {
|
installBtrfsStack() {
|
||||||
if ! command_exists snapper; then
|
if ! command_exists btrfs-assistant; then
|
||||||
printf "%b\n" "${YELLOW}Installing btrfs-assistant/snapper and dependencies...${RC}"
|
printf "%b\n" "${YELLOW}Installing Btrfs Assistant with snapper...${RC}"
|
||||||
case "$PACKAGER" in
|
case "$PACKAGER" in
|
||||||
dnf)
|
dnf)
|
||||||
"$ESCALATION_TOOL" "$PACKAGER" install -y btrfs-assistant inotify-tools python3-dnf-plugin-snapper make git
|
"$ESCALATION_TOOL" "$PACKAGER" install -y btrfs-assistant
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
|
||||||
|
@ -28,41 +28,83 @@ installBtrfsStack() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
printf "%b\n" "${GREEN}Snapper is already installed.${RC}"
|
printf "%b\n" "${GREEN}Btrfs Assistant is already installed.${RC}"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create first snapper config for root and home and create new manual snapshots
|
# Create first snapper config for root and home and create new manual snapshots
|
||||||
configureSnapper() {
|
configureSnapper() {
|
||||||
|
if command_exists snapper; then
|
||||||
|
printf "%b\n" "${YELLOW}Snapper tool detected. Do you want to configure root and home configs and take first snapshots? (y/n): ${RC}"
|
||||||
|
read -r response
|
||||||
|
case "$response" in
|
||||||
|
[yY]*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "%b\n" "${GREEN}Snapper configurations will not be changed.${RC}"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y snapper python3-dnf-plugin-snapper
|
||||||
|
fi
|
||||||
printf "%b\n" "${YELLOW}Creating snapper root(/) and home config and taking the first snapshots...${RC}"
|
printf "%b\n" "${YELLOW}Creating snapper root(/) and home config and taking the first snapshots...${RC}"
|
||||||
snapper -c root create-config / && snapper -c root create --description "First root Snapshot"
|
snapper -c root create-config / && snapper -c root create --description "First root Snapshot"
|
||||||
snapper -c home create-config /home && snapper -c home create --description "First home Snapshot"
|
snapper -c home create-config /home && snapper -c home create --description "First home Snapshot"
|
||||||
|
printf "%b\n" "${YELLOW}Updating timeline settings...${RC}"
|
||||||
# Modifyling default timeline root config
|
# Modifyling default timeline root config
|
||||||
"$ESCALATION_TOOL" sed -i 's/^TIMELINE_LIMIT_HOURLY="[^"]*"/TIMELINE_LIMIT_HOURLY="1"/' /etc/snapper/configs/root
|
"$ESCALATION_TOOL" sed -i '
|
||||||
"$ESCALATION_TOOL" sed -i 's/^TIMELINE_LIMIT_DAILY="[^"]*"/TIMELINE_LIMIT_DAILY="2"/' /etc/snapper/configs/root
|
s/^TIMELINE_LIMIT_HOURLY="[^"]*"/TIMELINE_LIMIT_HOURLY="1"/;
|
||||||
"$ESCALATION_TOOL" sed -i 's/^TIMELINE_LIMIT_WEEKLY="[^"]*"/TIMELINE_LIMIT_WEEKLY="1"/' /etc/snapper/configs/root
|
s/^TIMELINE_LIMIT_DAILY="[^"]*"/TIMELINE_LIMIT_DAILY="2"/;
|
||||||
"$ESCALATION_TOOL" sed -i 's/^TIMELINE_LIMIT_MONTHLY="[^"]*"/TIMELINE_LIMIT_MONTHLY="0"/' /etc/snapper/configs/root
|
s/^TIMELINE_LIMIT_WEEKLY="[^"]*"/TIMELINE_LIMIT_WEEKLY="1"/;
|
||||||
"$ESCALATION_TOOL" sed -i 's/^TIMELINE_LIMIT_YEARLY="[^"]*"/TIMELINE_LIMIT_YEARLY="0"/' /etc/snapper/configs/root
|
s/^TIMELINE_LIMIT_MONTHLY="[^"]*"/TIMELINE_LIMIT_MONTHLY="0"/;
|
||||||
|
s/^TIMELINE_LIMIT_YEARLY="[^"]*"/TIMELINE_LIMIT_YEARLY="0"/
|
||||||
|
' /etc/snapper/configs/root
|
||||||
# Modifyling default timeline for home config
|
# Modifyling default timeline for home config
|
||||||
"$ESCALATION_TOOL" sed -i 's/^TIMELINE_LIMIT_HOURLY="[^"]*"/TIMELINE_LIMIT_HOURLY="2"/' /etc/snapper/configs/home
|
"$ESCALATION_TOOL" sed -i '
|
||||||
"$ESCALATION_TOOL" sed -i 's/^TIMELINE_LIMIT_DAILY="[^"]*"/TIMELINE_LIMIT_DAILY="1"/' /etc/snapper/configs/home
|
s/^TIMELINE_LIMIT_HOURLY="[^"]*"/TIMELINE_LIMIT_HOURLY="2"/;
|
||||||
"$ESCALATION_TOOL" sed -i 's/^TIMELINE_LIMIT_WEEKLY="[^"]*"/TIMELINE_LIMIT_WEEKLY="0"/' /etc/snapper/configs/home
|
s/^TIMELINE_LIMIT_DAILY="[^"]*"/TIMELINE_LIMIT_DAILY="1"/;
|
||||||
"$ESCALATION_TOOL" sed -i 's/^TIMELINE_LIMIT_MONTHLY="[^"]*"/TIMELINE_LIMIT_MONTHLY="1"/' /etc/snapper/configs/home
|
s/^TIMELINE_LIMIT_WEEKLY="[^"]*"/TIMELINE_LIMIT_WEEKLY="0"/;
|
||||||
"$ESCALATION_TOOL" sed -i 's/^TIMELINE_LIMIT_YEARLY="[^"]*"/TIMELINE_LIMIT_YEARLY="0"/' /etc/snapper/configs/home
|
s/^TIMELINE_LIMIT_MONTHLY="[^"]*"/TIMELINE_LIMIT_MONTHLY="1"/;
|
||||||
|
s/^TIMELINE_LIMIT_YEARLY="[^"]*"/TIMELINE_LIMIT_YEARLY="0"/
|
||||||
|
' /etc/snapper/configs/home
|
||||||
|
printf "%b\n" "${GREEN}Snapper configs and first snapshots created.${RC}"
|
||||||
|
serviceStartEnable
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if the grub-btrfs dir exists before attempting to clone into it.
|
# Starting services
|
||||||
cloneGrubBtrfs() {
|
serviceStartEnable() {
|
||||||
printf "%b\n" "${YELLOW}Downloading grub-btrfs...${RC}"
|
printf "%b\n" "${YELLOW}Starting and enabling snapper-timeline.timer and snapper-cleanup.timer services...${RC}"
|
||||||
if [ -d "$HOME/grub-btrfs" ]; then
|
systemctl start snapper-timeline.timer && systemctl enable snapper-timeline.timer #enables scheduled timeline snapshots
|
||||||
rm -rf "$HOME/grub-btrfs"
|
systemctl start snapper-cleanup.timer && systemctl enable snapper-cleanup.timer #enables scheduled snapshot cleanup
|
||||||
fi
|
printf "%b\n" "${GREEN}Snapper services started and enabled.${RC}"
|
||||||
cd "$HOME" && git clone https://github.com/Antynea/grub-btrfs
|
}
|
||||||
|
|
||||||
|
# Ask user if they want to install grub-btrfs
|
||||||
|
askInstallGrubBtrfs() {
|
||||||
|
printf "%b\n" "${YELLOW}You can skip installing grub-btrfs and use only Btrfs Assistant GUI or snapper CLI.${RC}"
|
||||||
|
printf "%b\n" "${RED}grub-btrfs may cause problems on encrypted systems with secure boot/tpm. ${RC}"
|
||||||
|
printf "%b\n" "${YELLOW}Do you want to install grub-btrfs? (y/n): ${RC}"
|
||||||
|
read -r response
|
||||||
|
case "$response" in
|
||||||
|
[yY]*)
|
||||||
|
installGrubBtrfs
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf "%b\n" "${GREEN}Skipping grub-btrfs installation.${RC}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install grub-btrfs
|
# Install grub-btrfs
|
||||||
installGrubBtrfs() {
|
installGrubBtrfs() {
|
||||||
|
# Check if the grub-btrfs dir exists before attempting to clone into it.
|
||||||
|
printf "%b\n" "${YELLOW}Downloading grub-btrfs and installing dependencies...${RC}"
|
||||||
|
if [ -d "$HOME/grub-btrfs" ]; then
|
||||||
|
rm -rf "$HOME/grub-btrfs"
|
||||||
|
fi
|
||||||
|
"$ESCALATION_TOOL" "$PACKAGER" install -y make git inotify-tools
|
||||||
|
cd "$HOME" && git clone https://github.com/Antynea/grub-btrfs
|
||||||
printf "%b\n" "${YELLOW}Installing grub-btrfs...${RC}"
|
printf "%b\n" "${YELLOW}Installing grub-btrfs...${RC}"
|
||||||
cd "$HOME/grub-btrfs"
|
cd "$HOME/grub-btrfs"
|
||||||
printf "%b\n" "${YELLOW}Modifying grub-btrfs configuration for Fedora...${RC}"
|
printf "%b\n" "${YELLOW}Modifying grub-btrfs configuration for Fedora...${RC}"
|
||||||
|
@ -76,23 +118,15 @@ installGrubBtrfs() {
|
||||||
"$ESCALATION_TOOL" grub2-mkconfig -o /boot/grub2/grub.cfg && systemctl enable --now grub-btrfsd.service
|
"$ESCALATION_TOOL" grub2-mkconfig -o /boot/grub2/grub.cfg && systemctl enable --now grub-btrfsd.service
|
||||||
printf "%b\n" "${YELLOW}Cleaning up installation files...${RC}"
|
printf "%b\n" "${YELLOW}Cleaning up installation files...${RC}"
|
||||||
cd .. && rm -rf "$HOME/grub-btrfs" #deletes downloaded git folder
|
cd .. && rm -rf "$HOME/grub-btrfs" #deletes downloaded git folder
|
||||||
}
|
printf "%b\n" "${GREEN}Grub-btrfs installed and service enabled.${RC}"
|
||||||
|
printf "%b\n" "${CYAN}Notice: To perform a system recovery via grub-btrfs, after booting into your snapshot, do the 'restore' operation via Btrfs Assistant GUI.${RC}"
|
||||||
# Starting services
|
|
||||||
serviceStartEnable() {
|
|
||||||
printf "%b\n" "${YELLOW}Starting and enabling snapper-timeline.timer and snapper-cleanup.timer services...${RC}"
|
|
||||||
systemctl start snapper-timeline.timer && systemctl enable snapper-timeline.timer #enables scheduled timeline snapshots
|
|
||||||
systemctl start snapper-cleanup.timer && systemctl enable snapper-cleanup.timer #enables scheduled snapshot cleanup
|
|
||||||
printf "%b\n" "${YELLOW}Restarting grub-btrfsd service...${RC}"
|
|
||||||
systemctl restart grub-btrfsd
|
|
||||||
printf "%b\n" "${GREEN}Installation completed. Grub-btrfs and automatic snapshot configuration is now active.${RC}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Post install information
|
# Post install information
|
||||||
someNotices() {
|
someNotices() {
|
||||||
printf "%b\n" "${YELLOW}Notice: You can manage snapshots from the GUI with Btrfs Assistant.${RC}"
|
printf "%b\n" "${GREEN}Notice: Setup process completed.${RC}"
|
||||||
printf "%b\n" "${YELLOW}Notice: You may change (Hourly, daily, weekly, monthly, yearly) timeline settings via Btrfs Assistant GUI.${RC}"
|
printf "%b\n" "${YELLOW}Notice: You can manage snapshots from GUI with Btrfs Assistant or CLI with snapper.${RC}"
|
||||||
printf "%b\n" "${YELLOW}Notice: To perform a system recovery via Grub-btrfs, after booting into your snapshot, do the 'restore' operation via Btrfs Assistant GUI.${RC}"
|
printf "%b\n" "${YELLOW}Notice: You may change (Hourly, daily, weekly, monthly, yearly) timeline settings with Btrfs Assistant GUI.${RC}"
|
||||||
printf "%b\n" "${CYAN}Notice: If you used the default Fedora disk partitioning during OS installation, the /boot configured as an separate EXT4 partition. Therefore, it cannot be included in root snapshots. Backup separately...${RC}"
|
printf "%b\n" "${CYAN}Notice: If you used the default Fedora disk partitioning during OS installation, the /boot configured as an separate EXT4 partition. Therefore, it cannot be included in root snapshots. Backup separately...${RC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +135,5 @@ checkEscalationTool
|
||||||
checkFs
|
checkFs
|
||||||
installBtrfsStack
|
installBtrfsStack
|
||||||
configureSnapper
|
configureSnapper
|
||||||
cloneGrubBtrfs
|
askInstallGrubBtrfs
|
||||||
installGrubBtrfs
|
|
||||||
serviceStartEnable
|
|
||||||
someNotices
|
someNotices
|
||||||
|
|
|
@ -66,8 +66,8 @@ script = "fedora/virtualization.sh"
|
||||||
task_list = "I"
|
task_list = "I"
|
||||||
|
|
||||||
[[data.entries]]
|
[[data.entries]]
|
||||||
name = "Btrfs Assistant(+snapper), grub-btrfs Setup"
|
name = "Btrfs Assistant, Snapper Config, grub-btrfs"
|
||||||
description = "Installs Btrfs-Assistan/Snapper, dnf snapper plugin and takes the first root(/) and /home snapshots\nInstalls Grub-Btrfs.\nEnables snapper-timeline and snapper-cleanup services.\nNotice: To perform a system recovery via Grub-btrfs, after the snapshot is booted, restore with the Btrfs Assistant GUI.\nNotice: If you used the default Fedora disk partitioning during OS installation, the /boot configured as an separate EXT4 partition. Therefore, it cannot be included in root snapshots. Backup separately."
|
description = "Installs Btrfs Assistant, Snapper, dnf snapper plugin and takes the first root(/) and /home snapshots.\nEnables snapper-timeline and snapper-cleanup services.\n(Optionally)Installs Grub-Btrfs.\nTo perform a system recovery via grub-btrfs, do restore operation with Btrfs Assistant GUI after booting into snapshot.\nNotice: If you used the default Fedora disk partitioning during OS installation, the /boot configured as an separate EXT4 partition. Therefore, it cannot be included in root snapshots. Backup separately."
|
||||||
script = "fedora/fedora-btrfs-assistant.sh"
|
script = "fedora/fedora-btrfs-assistant.sh"
|
||||||
task_list = "I"
|
task_list = "I"
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
- **NVIDIA Proprietary Driver Setup**: Installs proprietary NVIDIA drivers for GPUs from 2014 or later.
|
- **NVIDIA Proprietary Driver Setup**: Installs proprietary NVIDIA drivers for GPUs from 2014 or later.
|
||||||
- **Virtualization Setup**: Installs virtualization tools.
|
- **Virtualization Setup**: Installs virtualization tools.
|
||||||
- **Configure DNF**: Optimizes DNF for better speeds.
|
- **Configure DNF**: Optimizes DNF for better speeds.
|
||||||
- **Btrfs Assistant(+snapper), grub-btrfs Setup**: Installs Btrfs-Assistan/Snapper, dnf snapper plugin and takes the first root(/) and /home snapshots. Notice: The /boot configured as a separate EXT4 partition by default in Fedora, so it can't be included in the snapshots. Backup it seperately.
|
- **Btrfs Assistant, Snapper Config, grub-btrfs**: Installs Btrfs Assistant, Snapper, dnf snapper plugin and grub-btrfs. Creates snapper configs. Notice: The /boot configured as a separate EXT4 partition by default in Fedora, so it can't be included in the snapshots. Backup it seperately.
|
||||||
|
|
||||||
## Applications Setup
|
## Applications Setup
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user