-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnable-Ntfs.bash
More file actions
executable file
·52 lines (41 loc) · 1.33 KB
/
Copy pathEnable-Ntfs.bash
File metadata and controls
executable file
·52 lines (41 loc) · 1.33 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
#!/bin/bash
# Importing functions run_as_root, get_os_type and install_rpm_package
source RunAsRoot.bash
source OsInfo.bash
source RpmPackageManager.bash
# Running as root
run_as_root
# Function that verifies if the system is compatible with NTFS3 Linux Kernel Module
function is_kernel_compatible_with_ntfs3_module() {
# Minimum required version for the module ntfs3
minimal_kernel_version="5.15"
# Get current kernel version (only the version, no suffix)
current_kernel_version=$(uname -r | cut -d- -f1)
# Checking if kernel version is >= 5.15
if [ "$(printf '%s\n' "$minimal_kernel_version" "$current_kernel_version" | sort -V | head -n1)" = "$minimal_kernel_version" ]; then
kernel_config_path="/boot/config-$(uname -r)"
# Checking if kernel configuration folder exists
if [ -f "$kernel_config_path" ]; then
# Checking if NTFS3 module is supported
if grep -q '^CONFIG_NTFS3_FS=m' "$kernel_config_path"; then
echo 1
else
echo 0
fi
else
echo 0
fi
else
echo 0
fi
}
# Creating initialization file
if [ "$(is_kernel_compatible_with_ntfs3_module)" == 1 ]; then
load_modules_folder="/etc/modules-load.d/"
mkdir -p "$load_modules_folder"
echo "ntfs3" > "$load_modules_folder/ntfs3.conf"
modprobe ntfs3
# Installing ntfs-3g
else
install_rpm_package ntfs-3g
fi