LinuxSetup/setupstorage.sh

65 lines
2.6 KiB
Bash
Raw Normal View History

2024-08-26 20:16:55 +00:00
#!/bin/bash
# Create folders for fstab
# Array of directories to create
directories=(
# Setup home dir
~/Applications
~/Developer/Projects
~/Developer/UnrealEngine/Engine
~/Developer/UnrealEngine/Vault
~/Games/SSD
~/Games/HDD
~/Notes
~/.virtualization
~/.virtualization/storage/ssd
~/.virtualization/storage/hdd
~/.virtualization/storage/installer
/mnt/storage
# Custom folders
/mnt/storage/.fstab/Projects
/mnt/storage/.fstab/Engine
/mnt/storage/.fstab/Vault
/mnt/storage/.fstab/Games
/mnt/storage/.fstab/virtualization/hdd
/mnt/storage/.fstab/virtualization/installer
# Default Folders
/mnt/storage/.fstab/Downloads
/mnt/storage/.fstab/Music
/mnt/storage/.fstab/Pictures
/mnt/storage/.fstab/Videos
)
# Iterate over the array and create each directory if it doesn't exist
for dir in "${directories[@]}"; do
mkdir -p "$dir"
done
# Create links
# Array of lines to add to /etc/fstab
fstab_entries=(
"/mnt/storage/.fstab/Projects /home/boo3/Applications none bind,x-gvfs-hide 0 0"
"/mnt/storage/.fstab/Engine /home/boo3/Developer/UnrealEngine/Engine none bind,x-gvfs-hide 0 0"
"/mnt/storage/.fstab/Vault /home/boo3/Developer/UnrealEngine/Vault none bind,x-gvfs-hide 0 0"
"/mnt/storage/.fstab/Games /home/boo3/Games/HDD none bind,x-gvfs-hide 0 0"
"/mnt/storage/.fstab/virtualization/hdd /home/boo3/.virtualization/storage/hdd none bind,x-gvfs-hide 0 0"
"/mnt/storage/.fstab/virtualization/installer /home/boo3/.virtualization/storage/installer none bind,x-gvfs-hide 0 0"
"/mnt/storage/.fstab/Downloads /home/boo3/Downloads none bind,x-gvfs-hide 0 0"
"/mnt/storage/.fstab/Music /home/boo3/Music none bind,x-gvfs-hide 0 0"
"/mnt/storage/.fstab/Pictures /home/boo3/Pictures none bind,x-gvfs-hide 0 0"
"/mnt/storage/.fstab/Videos /home/boo3/Videos none bind,x-gvfs-hide 0 0"
)
# Iterate over the array and add each entry to /etc/fstab if it doesn't already exist
for entry in "${fstab_entries[@]}"; do
if ! grep -qF "$entry" /etc/fstab; then
echo "$entry" | sudo tee -a /etc/fstab > /dev/null
echo "Added entry: $entry"
else
echo "Entry already exists: $entry"
fi
done
sudo reboot