aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/i-data-lists.sh
blob: 9338e875254cd8870798ba3496dbf4c09f60cd35 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
# SPDX-FileCopyrightText: 2023 Markus Uhlin <maxxe@rpblc.net>
# SPDX-License-Identifier: ISC

i_data_lists () {
	local _path _files

	_path="${1}"

# HelpToIndex
# index
# README
	_files="
abuser
admin
ban
blind
cmuzzle
computer
filter
fm
gm
im
muzzle
programmer
removedcom
td
teams
"

	echo "installing..."

	if [ ! -r "${_path}/index" ]; then
		cat <<EOF > "${_path}/index"
abuser 0
admin -1
ban 0
blind 1
cmuzzle 0
computer 1
filter 0
fm 1
gm 1
im 1
muzzle 0
programmer -1
removedcom -1
td -1
teams 1
EOF
		if [ $? -eq 0 ]; then
			echo "created ${_path}/index"
		fi
	fi

	for file in ${_files}; do
		printf "creating '%s': " "${_path}/${file}"
		if [ -r "${_path}/${file}" ]; then
			echo "already exists (good)"
		else
			cat /dev/null > "${_path}/${file}"
			if [ $? -eq 0 ]; then
				echo "ok"
			else
				echo "error"
			fi
		fi
	done
}

i_data_lists "${1}"