summarylogtreecommitdiffstats
path: root/gnunet.install
blob: 2560926d8cbf87bcf6b93d6850771b8166aa01b3 (plain)
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
post_install() {

	local _PWD_PAIRS_="$(awk -F ':' '$3>=1000 && $3<2000 {print $1":"$6}' '/etc/passwd')"
	local _USER_
	local _GROUP_
	local _CFG_DIR_

	for _PWD_PAIR_ in ${_PWD_PAIRS_}; do
		_USER_="$(echo $_PWD_PAIR_ | cut -d ':' -f 1)"
		_GROUP_="$(id -gn "${_USER_}")"
		_CFG_DIR_="$(echo $_PWD_PAIR_ | cut -d ':' -f 2)/.config"
		test -e "${_CFG_DIR_}/gnunet.conf" || (install -dm700 -o \
			"${_USER_}" -g "${_GROUP_}" "${_CFG_DIR_}" && install \
			-Dm600 -o "${_USER_}" -g "${_GROUP_}" \
			'/etc/skel/.config/gnunet.conf' \
			"${_CFG_DIR_}/gnunet.conf")
	done

	echo
	echo 'Do not forget to add your user to the `gnunet` group, with'
	echo
	echo '    sudo usermod -aG gnunet "$(whoami)"'
	echo
	echo 'If later you want to remove your user from the group, launch'
	echo
	echo '    sudo gpasswd --delete "$(whoami)" gnunet'
	echo
	echo 'For information on how to use GNUnet plaese refer to the GNUnet article in the'
	echo 'ArchWiki (https://wiki.archlinux.org/title/GNUnet).'
	echo

}

post_remove() {

	echo
	echo 'The home directory of the `gnunet` user (`/var/lib/gnunet/`) is left after'
	echo 'uninstalling GNUnet. If you are sure that you are never going to use GNUnet'
	echo 'ever again, launch:'
	echo
	echo '    for username in $(getent group gnunet | cut -d: -f4 | tr '\'','\'' '\'' '\''); do \'
	echo '        sudo gpasswd --delete "${username}" gnunet; done'
	echo '    sudo userdel -r gnunet'
	echo '    sudo groupdel gnunetdns'
	echo
	echo '**Warning** The identity and all the information about the network'
	echo 'cumulatively stored by the current peer will be destroyed - this will not'
	echo 'affect files explicitly downloaded in other paths.'
	echo
	echo 'For further information plaese refer to the GNUnet article in the ArchWiki'
	echo '(https://wiki.archlinux.org/title/GNUnet).'
	echo

}