diff --git a/scripts/install-terraform-arch.sh b/scripts/install-terraform-arch.sh new file mode 100755 index 0000000..65e16aa --- /dev/null +++ b/scripts/install-terraform-arch.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Exit if any command fails and treat unset variables as an error +set -eu + +# Function to execute a command and print a custom error message if it fails +execute() { + echo "$2" + $1 +} + +# Ensure the script is being run with superuser privileges +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" + exit 1 +fi + +# Update the system +execute "pacman -Syu" "Updating the system..." + +# Install Terraform using yay +execute "yay -S terraform" "Installing Terraform..." + +echo "Terraform installation completed successfully." \ No newline at end of file diff --git a/scripts/snapshot-arch.sh b/scripts/snapshot-arch.sh new file mode 100644 index 0000000..b5f210b --- /dev/null +++ b/scripts/snapshot-arch.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Exit if any command fails and treat unset variables as an error +set -eu + +# Define the source and destination directories +src_dir="$HOME/Desktop" +dst_dir="$HOME/snapshots" + +# Ensure the destination directory exists +mkdir -p "$dst_dir" + +# Create a snapshot of the source directory +btrfs subvolume snapshot "$src_dir" "$dst_dir/desktop_snapshot_$(date +%Y%m%d%H%M%S)" + +#/etc/crontab +# System Reboot takes a snapshot +# @reboot $HOME/snapshots/snapshot.sh +# Every 12 hours take a snapshot +# 0 */12 * * * $HOME/snapshots/snapshot.sh \ No newline at end of file