-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01-dirs.sh
More file actions
70 lines (61 loc) · 1.22 KB
/
01-dirs.sh
File metadata and controls
70 lines (61 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
###########
# Minimum filesystem setup
###########
# Ensure the SOV_DIR variable is set
if [[ -z "$SOV_DIR" ]]; then
echo "Error: SOV_DIR is not set."
exit 1
fi
# Create the base directories
BASE_DIRS=("mnt" "opt")
SUBDIRS=(
"efi/loader"
"efi/EFI/BOOT"
"efi/EFI/Linux"
"efi/EFI/systemd"
"etc/kernel"
"etc/pam.d"
"etc/systemd/network"
"etc/systemd/system"
"etc/systemd/system-preset"
"etc/sysupdate.d"
"etc/udev/rules.d"
"usr/bin"
"usr/etc"
"usr/include"
"usr/lib"
"usr/libexec"
"usr/local"
"usr/share"
"usr/src"
"var/cache"
"var/lib/confexts"
"var/lib/extensions"
"var/local"
"var/log"
"var/mail"
"var/opt"
"var/spool"
"var/tmp"
)
# Create directories
mkdir -pv "$SOV_DIR"
for dir in "${BASE_DIRS[@]}"; do
mkdir -pv "$SOV_DIR/$dir"
done
for dir in "${SUBDIRS[@]}"; do
mkdir -pv "$SOV_DIR/$dir"
done
# Create symbolic links
ln -sv usr/bin "$SOV_DIR/bin"
ln -sv usr/bin "$SOV_DIR/sbin"
ln -sv usr/lib "$SOV_DIR/lib"
ln -sv usr/lib "$SOV_DIR/lib64"
ln -sv lib "$SOV_DIR/usr/lib64"
ln -sv bin "$SOV_DIR/usr/sbin"
# Indicate completion
touch "$SOV_DIR/01-complete"
echo "Filesystem setup complete!"