mirror of
https://github.com/ovh/debian-cis.git
synced 2025-06-22 02:33:42 +02:00
6.2_disable_avahi_server.sh 6.3_disable_print_server.sh 6.4_disable_dhcp.sh 6.5_configure_ntp.sh 6.6_diable_ldap.sh 6.7_disable_nfs_rpc.sh 6.8_disable_dns_server.sh
This commit is contained in:
19
lib/utils.sh
19
lib/utils.sh
@ -107,7 +107,16 @@ add_end_of_file() {
|
||||
echo "$2" >> $FILE
|
||||
}
|
||||
|
||||
add_line_file_before_pattern() {
|
||||
local FILE=$1
|
||||
local LINE=$2
|
||||
local PATTERN=$3
|
||||
|
||||
debug "Inserting $LINE before $PATTERN in $FILE"
|
||||
debug "sed -i '/$PATTERN/i $LINE' $FILE"
|
||||
sed -i "/$PATTERN/i $LINE" $FILE
|
||||
FNRET=0
|
||||
}
|
||||
#
|
||||
# User manipulation
|
||||
#
|
||||
@ -242,7 +251,7 @@ remount_partition() {
|
||||
}
|
||||
|
||||
#
|
||||
# Helper functions to work with apt
|
||||
# APT manipulation
|
||||
#
|
||||
|
||||
apt_update_if_needed()
|
||||
@ -279,6 +288,14 @@ apt_check_updates()
|
||||
rm $DETAILS
|
||||
}
|
||||
|
||||
apt_install()
|
||||
{
|
||||
local PACKAGE=$1
|
||||
DEBIAN_FRONTEND='noninteractive' apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $PACKAGE -y
|
||||
FNRET=0
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Returns if a package is installed
|
||||
#
|
||||
|
Reference in New Issue
Block a user