summaryrefslogtreecommitdiff
path: root/libre/filesystem/PKGBUILD
blob: f64cbd4b534d2f038ee63627cdce040caa868d8a (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# $Id: PKGBUILD 282858 2016-12-05 23:47:36Z seblu $
# Maintainer (Arch): Sébastien Luttringer
# Contributor (Arch): Tom Gundersen <teg@jklm.no>
# Maintainer: Nicolás Reynolds <fauno@kiwwwi.com.ar>
# Maintainer: André Silva <emulatorman@parabola.nu>

pkgname=filesystem
pkgver=2016.12
pkgrel=2.parabola1
pkgdesc='Base Parabola GNU/Linux-libre files (Parabola rebranded)'
arch=('i686' 'x86_64' 'armv7h')
license=('GPL')
url='https://www.parabola.nu'
groups=('base')
install='filesystem.install'
makedepends=('asciidoc')
depends=('iana-etc')
replaces=(filesystem-parabola)
conflicts=(filesystem-parabola)
backup=('etc/fstab' 'etc/crypttab' 'etc/group' 'etc/hosts' 'etc/ld.so.conf' 'etc/passwd'
        'etc/shadow' 'etc/gshadow' 'etc/resolv.conf' 'etc/motd' 'etc/nsswitch.conf'
        'etc/shells' 'etc/host.conf' 'etc/securetty' 'etc/profile' 'etc/issue')
source=('group' 'issue' 'nsswitch.conf' 'securetty' 'host.conf' 'ld.so.conf'
        'passwd' 'shadow' 'fstab' 'crypttab' 'hosts' 'motd' 'os-release' 'resolv.conf'
        'shells' 'gshadow' 'profile' 'parabola.7.txt' 'locale.sh')
md5sums=('4d7417d2bf8872665c0907f09ae37c34'
         '6be47d893fd49b2e4a8c0e811b350861'
         '7b21f0f97f048988908bf93778bba65f'
         '4c4540eeb748bf1f71d631b8c1dcf0b3'
         'f28150d4c0b22a017be51b9f7f9977ed'
         '6e488ffecc8ba142c0cf7e2d7aeb832e'
         'a998d1e6c7cc5791a7f4a2b49b2d10ce'
         '1ec1b16e2a71fad63ab8f147069a5d97'
         '693c97f2c9a519bb97a17008e92c2b74'
         '49639d107b75fe4e668ae27749da32ab'
         '7bc65f234dfb6abf24e7c3b03e86f4ff'
         'd41d8cd98f00b204e9800998ecf8427e'
         '83e0de34441a56684db8f813099d62f8'
         '6f48288b6fcaf0065fcb7b0e525413e0'
         '22518e922891f9359f971f4f5b4e793c'
         '69e460404f45bdb7288d1de662e56dd9'
         'cfa3345c485c59e681ab39a44dc7ece1'
         'd5732ffdb3488e1383d4ea199343e767'
         '71ed98c52e11ada1f936ac8cb14eecd9')

lint() {
	# ensure that passwd is sync'd to shadow and group is sync'd to gshadow.
	local r=0

	local passwd shadow group gshadow

	for f in passwd shadow group gshadow; do
		mapfile -t "$f" < <(cut -d: -f1 "$f" | sort)
	done

	# we can cheat and do simple string comparison only because we can make some
	# assumptions about the data in these files
	if [[ ${passwd[*]} != "${shadow[*]}" ]]; then
		error 'passwd is not in sync with shadow!'
		r=1
	fi

	if [[ ${group[*]} != "${gshadow[*]}" ]]; then
		error 'group is not in sync with gshadow!'
		r=1
	fi

	return $r
}

build() {
	cd "$srcdir"

	lint

	a2x -d manpage -f manpage parabola.7.txt
}

package() {
	cd "$pkgdir"

	#
	# setup root filesystem
	#
	for d in boot dev etc home mnt usr var opt srv/http run; do
		install -d -m755 $d
	done
	install -d -m555 proc
	install -d -m555 sys
	install -d -m0750 root
	install -d -m1777 tmp
	# vsftpd won't run with write perms on /srv/ftp
	install -d -m555 -g ftp srv/ftp

	# setup /etc
	install -d etc/{ld.so.conf.d,skel,profile.d}
	for f in fstab group host.conf hosts issue ld.so.conf motd nsswitch.conf passwd resolv.conf securetty shells profile; do
		install -m644 "$srcdir"/$f etc/
	done
	ln -s /proc/self/mounts etc/mtab
	for f in gshadow shadow crypttab; do
		install -m600 "$srcdir"/$f etc/
	done
	touch etc/parabola-release
	ln -sv parabola-release etc/arch-release
	install -m755 "$srcdir"/locale.sh etc/profile.d/locale.sh
	install -Dm644 "$srcdir"/os-release "$pkgdir"/usr/lib/os-release

	# setup /var
	for d in cache local opt log/old lib/misc empty; do
		install -d -m755 var/$d
	done
	install -d -m1777 var/{tmp,spool/mail}

	# allow setgid games to write scores
	install -d -m775 -g games var/games
	ln -s spool/mail var/mail
	ln -s ../run var/run
	ln -s ../run/lock var/lock

	#
	# setup /usr hierarchy
	#
	for d in bin include lib share/misc src; do
		install -d -m755 usr/$d
	done
	for d in $(seq 8); do
		install -d -m755 usr/share/man/man$d
	done

	#
	# add lib symlinks
	#
	ln -s usr/lib "$pkgdir"/lib
	[[ $CARCH = 'x86_64' ]] && (
		ln -s usr/lib "$pkgdir"/lib64
		ln -s lib "$pkgdir"/usr/lib64
	)

	#
	# add bin symlinks
	#
	ln -s usr/bin "$pkgdir"/bin
	ln -s usr/bin "$pkgdir"/sbin
	ln -s bin "$pkgdir"/usr/sbin

	#
	# install parabola(7) manpage
	#
	install -D -m644 "$srcdir"/parabola.7 usr/share/man/man7/parabola.7

	#
	# setup /usr/local hierarchy
	#
	for d in bin etc games include lib man sbin share src; do
		install -d -m755 usr/local/$d
	done
	ln -s ../man usr/local/share/man
}