updates fstab script
This commit is contained in:
@@ -1,7 +1,44 @@
|
|||||||
cat fstab | sudo tee -a /etc/fstab
|
#!/bin/bash
|
||||||
|
|
||||||
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# cat fstab | sudo tee -a /etc/fstab
|
||||||
|
|
||||||
sudo mkdir /kpnas
|
sudo mkdir /kpnas
|
||||||
cd /kpnas
|
cd /kpnas
|
||||||
sudo mkdir videos vfx library localData web videos
|
sudo mkdir videos vfx library localData web videos
|
||||||
cd ~/
|
cd ~/
|
||||||
mkdir fabrication projects Remote
|
mkdir fabrication projects Remote
|
||||||
|
|
||||||
|
# Change to the script's directory
|
||||||
|
cd "$script_dir" || exit
|
||||||
|
# Now you are in the script's directory
|
||||||
|
echo "Current directory: $(pwd)"
|
||||||
|
|
||||||
|
# Path to the file containing fstab entries
|
||||||
|
entries_file="fstab"
|
||||||
|
|
||||||
|
if [[ ! -f "$entries_file" ]]; then
|
||||||
|
echo "Entries file '$entries_file' not found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Backup the original fstab file
|
||||||
|
# cp /etc/fstab /etc/fstab.bak
|
||||||
|
# Function to check if an entry exists in fstab
|
||||||
|
entry_exists() {
|
||||||
|
local entry="$1"
|
||||||
|
grep -qF -- "$entry" /etc/fstab
|
||||||
|
}
|
||||||
|
# Read entries from the file and add them if they don't exist
|
||||||
|
while IFS= read -r entry; do
|
||||||
|
# Skip empty lines or lines starting with #
|
||||||
|
[[ -z "$entry" || "$entry" =~ ^# ]] && continue
|
||||||
|
if entry_exists "$entry"; then
|
||||||
|
echo "Entry already exists: $entry"
|
||||||
|
else
|
||||||
|
echo "Adding entry: $entry"
|
||||||
|
echo "$entry" | sudo tee -a /etc/fstab >/dev/null
|
||||||
|
fi
|
||||||
|
done <"$entries_file"
|
||||||
|
echo "Done."
|
||||||
|
|||||||
22
common/fstab
22
common/fstab
@@ -1,10 +1,12 @@
|
|||||||
192.168.86.50:/Carlos/Documents /home/carlos/Documents nfs nofail 0 2
|
kp-server:/mnt/data /kpnas/data nfs nofail 0 2
|
||||||
192.168.86.50:/Carlos/Images /home/carlos/Pictures nfs nofail 0 2
|
192.168.86.50:/Library /kpnas/library nfs nofail 0 2
|
||||||
192.168.86.50:/Fabrication /home/carlos/fabrication nfs nofail 0 2
|
192.168.86.50:/LocalData /kpnas/localData nfs nofail 0 2
|
||||||
192.168.86.50:/Projects /home/carlos/projects nfs nofail 0 2
|
192.168.86.50:/Media /kpnas/media nfs nofail 0 2
|
||||||
192.168.86.50:/Carlos /home/carlos/Remote nfs nofail 0 2
|
192.168.86.50:/NVME /kpnas/nvme nfs nofail 0 2
|
||||||
192.168.86.50:/Library /kpnas/library nfs nofail 0 2
|
192.168.86.50:/Videos /kpnas/videos nfs nofail 0 2
|
||||||
192.168.86.50:/LocalData /kpnas/localData nfs nofail 0 2
|
192.168.86.50:/VFX /kpnas/vfx nfs nofail 0 2
|
||||||
192.168.86.50:/VFX /kpnas/vfx nfs nofail 0 2
|
192.168.86.50:/Web /kpnas/web nfs nofail 0 2
|
||||||
192.168.86.50:/Videos /kpnas/videos nfs nofail 0 2
|
192.168.86.50:/Carlos/Images /home/carlos/Pictures nfs nofail 0 2
|
||||||
192.168.86.50:/Web /kpnas/web nfs nofail 0 2
|
192.168.86.50:/Fabrication /home/carlos/fabrication nfs nofail 0 2
|
||||||
|
192.168.86.50:/Projects /home/carlos/projects nfs nofail 0 2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user