File: dconf_test_functions.sh

package info (click to toggle)
scap-security-guide 0.1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 110,644 kB
  • sloc: xml: 241,883; sh: 73,777; python: 32,527; makefile: 27
file content (55 lines) | stat: -rw-r--r-- 1,273 bytes parent folder | download
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

# Check if gdm and dconf are installed, if not then install them
install_dconf_and_gdm_if_needed(){
	if ! rpm -q dconf; then
		yum -y install dconf
	fi

	if ! rpm -q gdm; then
		yum -y install gdm
	fi
}

# Wipes out dconf db settings directory
clean_dconf_settings(){
	rm -rf /etc/dconf/db/*
}

# Wipes out dconf db files
remove_dconf_databases(){
	rm -f /etc/dconf/db/*
}

# Adds a new dconf setting
# $1 _path
# $2 _setting
# $3 _value
# $4 _db
# $5 _settingFile
add_dconf_setting() {
	local _path=$1 _setting=$2 _value=$3 _db=$4 _settingFile=$5
	mkdir -p /etc/dconf/db/${_db} || true
	echo "[${_path}]" > /etc/dconf/db/${_db}/${_settingFile}
	echo "${_setting}=${_value}" >> /etc/dconf/db/${_db}/${_settingFile}
}

# Adds a lock to a dconf setting
# $1 _path
# $2 _setting
# $3 _db
# $4 _settingFile
add_dconf_lock(){
	local _path=$1 _setting=$2 _db=$3 _settingFile=$4
	mkdir -p /etc/dconf/db/${_db}/locks
	echo "/${_path}/${_setting}" >> /etc/dconf/db/${_db}/locks/${_settingFile}
}

# Adds the user profile
add_dconf_profiles() {
    {{% if 'ubuntu' in product %}}
    mkdir -p /etc/dconf/profile
    echo -e "user-db:user\nsystem-db:gdm" > /etc/dconf/profile/gdm
    echo -e "user-db:user\nsystem-db:local" > /etc/dconf/profile/user
    {{% endif %}}
    return 0
}