mirror of
https://github.com/hardenedlinux/harbian-audit.git
synced 2025-07-31 01:24:58 +02:00
Add Notice and example description for add_option_to_fstab method.
This commit is contained in:
parent
fcdf429202
commit
f44528cddb
12
lib/utils.sh
12
lib/utils.sh
@ -329,16 +329,20 @@ has_mounted_option() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Setup mount option in fstab
|
# Setup mount option in fstab
|
||||||
|
# Notice: The format of the entry in the fstab file must be in the format shown in the following example, otherwise an error may occur.
|
||||||
add_option_to_fstab() {
|
add_option_to_fstab() {
|
||||||
local PARTITION=$1
|
local PARTITION=$1
|
||||||
local OPTION=$2
|
local OPTION=$2
|
||||||
debug "Setting $OPTION for $PARTITION in fstab"
|
debug "Setting $OPTION for $PARTITION in fstab"
|
||||||
backup_file "/etc/fstab"
|
backup_file "/etc/fstab"
|
||||||
# For example :
|
# For example :
|
||||||
# /dev/sda9 /home ext4 auto,acl,errors=remount-ro 0 2
|
# local PARTITION="/home"
|
||||||
# /dev/sda9 /home ext4 auto,acl,errors=remount-ro,nodev 0 2
|
# local OPTION="nosuid"
|
||||||
debug "Sed command : sed -ie \"s;\(.*\)\(\s*\)\s\($PARTITION\)\s\(\s*\)\(\w*\)\(\s*\)\(\w*\)*;\1\2 \3 \4\5\6\7,$OPTION;\" /etc/fstab"
|
# UUID=40327bc9-f9d1-5816-a312-df307cc8732e /home ext4 errors=remount-ro 0 2
|
||||||
|
# UUID=40327bc9-f9d1-5816-a312-df307cc8732e /home ext4 errors=remount-ro,nosuid 0 2
|
||||||
|
# debug "Sed command : sed -ie \"s;\(.*\)\(\s*\)\s\($PARTITION\)\s\(\s*\)\(\w*\)\(\s*\)\(\w*\)*;\1\2 \3 \4\5\6\7,$OPTION;\" /etc/fstab"
|
||||||
# sed -ie "s;\(.*\)\(\s*\)\s\($PARTITION\)\s\(\s*\)\(\w*\)\(\s*\)\(\w*\)*;\1\2 \3 \4\5\6\7,$OPTION;" /etc/fstab
|
# sed -ie "s;\(.*\)\(\s*\)\s\($PARTITION\)\s\(\s*\)\(\w*\)\(\s*\)\(\w*\)*;\1\2 \3 \4\5\6\7,$OPTION;" /etc/fstab
|
||||||
|
debug "Sed -ie "s;\(^[^#].*${PARTITION}\)\(\s.*\)\(\s\w.*\)\(\s[0-2]\s*[0-2]\);\1\2\3,${OPTION}\4;" /etc/fstab"
|
||||||
sed -ie "s;\(^[^#].*${PARTITION}\)\(\s.*\)\(\s\w.*\)\(\s[0-2]\s*[0-2]\);\1\2\3,${OPTION}\4;" /etc/fstab
|
sed -ie "s;\(^[^#].*${PARTITION}\)\(\s.*\)\(\s\w.*\)\(\s[0-2]\s*[0-2]\);\1\2\3,${OPTION}\4;" /etc/fstab
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user