Fix PKGBUILD
[archnosh.git] / PKGBUILD
blob68589f9395e2a43c632795cbf7b4d6d17204bf44
1 # Maintainer:  taca <taca@kadisius.eu>
3 pkgbase=nosh
4 pkgname=(
5     'nosh-common'
6     'nosh-guide'
7     'nosh-exec'
8     'nosh-service-management'
9     'nosh-terminal-management'
10     'nosh-terminal-extras'
11     'nosh-zsh-completion'
12     'nosh-systemv-shims'
13     'nosh-systemd-shims'
14     'nosh-upstart-shims'
15     'nosh-execline-shims'
16     'nosh-core-shims'
17     'nosh-service-command-shim'
18     'nosh-debian-shims'
19     'nosh-openbsd-shims'
20     'nosh-freebsd-shims'
21     'nosh-bsd-shims'
22     'nosh-ucspi-tcp-shims'
23     'nosh-kbd-shims'
24      #'nosh-logrotate-shims'
25     'nosh-bundles'
26     'nosh-run-system-manager'
27     'nosh-run-debian-desktop-base'
28     'nosh-run-debian-server-base'
29     'nosh-run-kernel-vt'
30     'nosh-run-user-vt'
31     'nosh-run-via-systemd'
32     'nosh-run-virtualbox-guest'
33     'nosh-run-freedesktop-system-bus'
34     'nosh-run-freedesktop-kits'
35     'nosh-run-openssh-server'
36     'nosh-run-appletalk'
37     'nosh-run-udev'
38     'nosh-run-systemd-udev'
39     'nosh-run-busybox-mdev'
40     'nosh-run-suckless-mdev'
41     'nosh-run-vdev'
42     'nosh-run-local-syslog'
43     'nosh-run-klog'
44     )               
45 pkgver=1.38
46 pkgrel=1
47 pkgdesc="A suite of system-level utilities for initializing and running a BSD or Linux system, for managing daemons, for managing terminals, and for managing logging."
48 arch=('x86_64')
49 url="https://jdebp.eu/Softwares/nosh/index.html"
50 license=('custom:MIT Expat' 'custom:FreeBSD' 'custom:ISC' 'custom:Simplified BSD')
51 groups=()
52 depends=()
53 makedepends=('pax' 'docbook-xml' 'docbook-xsl' 'xmlto' 'redo-jdebp')
54 checkdepends=()
55 optdepends=()
56 provides=()
57 conflicts=()
58 replaces=()
59 backup=()
60 options=()
61 install=""
62 changelog="archnosh.changelog"
64 # packages with maintenance scripts
65 _pkginstalls=( 
66         "nosh-bundles"
67         "nosh-run-busybox-mdev"
68         "nosh-run-debian-desktop-base"
69         "nosh-run-debian-server-base"
70         "nosh-run-freedesktop-kits"
71         "nosh-run-freedesktop-system-bus"
72         "nosh-run-kernel-vt"
73         "nosh-run-klog"
74         "nosh-run-local-syslog"
75         "nosh-run-openssh-server"
76         "nosh-run-suckless-mdev"
77         "nosh-run-systemd-udev"
78         "nosh-run-system-manager"
79         "nosh-run-udev"
80         "nosh-run-user-vt"
81         "nosh-run-via-systemd"
82         "nosh-run-virtualbox-guest"
83         "nosh-service-management"
84         )
85         
86 # no point in distributing empty files, create them now, they are filled in later
87 for i in ${_pkginstalls[@]}
89         touch $i.install
90 done
91     
92 source=("https://jdebp.eu/Repository/freebsd/nosh-$pkgver.tar.gz"
93         "staging.patch"
94         "maintenance-scripts.patch"
95         "scriptletbuilder.sh"
96         
97         "nosh-bundles.install"
98         "nosh-run-busybox-mdev.install"
99         "nosh-run-debian-desktop-base.install"
100         "nosh-run-debian-server-base.install"
101         "nosh-run-freedesktop-kits.install"
102         "nosh-run-freedesktop-system-bus.install"
103         "nosh-run-kernel-vt.install"
104         "nosh-run-klog.install"
105         "nosh-run-local-syslog.install"
106         "nosh-run-openssh-server.install"
107         "nosh-run-suckless-mdev.install"
108         "nosh-run-systemd-udev.install"
109         "nosh-run-system-manager.install"
110         "nosh-run-udev.install"
111         "nosh-run-user-vt.install"
112         "nosh-run-via-systemd.install"
113         "nosh-run-virtualbox-guest.install"
114         "nosh-service-management.install"
115         )
116 noextract=()
117 sha256sums=(
118             '603241430898c4e133880fdecc10bacd1ad8928d175cccc2cab1e626886282f4' # nosh-1.38.tar.gz
119             '247536be7ff4207bb5ece3199818e502bb07dd09ada65191f12ca98e5d885d19' # staging.patch
120             '669e73dddeb9e01f57f9d7a134352697f90178dc32c79847f2080326a1993dc9' # maintenance-scripts.patch
121             '907d92546845ab087be38515fcbd04bec68b68a250534063695e73646241454c' # scriptletbuilder.sh
122             
123             'SKIP' # nosh-bundles.install
124             'SKIP' # nosh-run-busybox-mdev.install
125             'SKIP' # nosh-run-debian-desktop-base.install
126             'SKIP' # nosh-run-debian-server-base.install
127             'SKIP' # nosh-run-freedesktop-kits.install
128             'SKIP' # nosh-run-freedesktop-system-bus.install
129             'SKIP' # nosh-run-kernel-vt.install
130             'SKIP' # nosh-run-klog.install
131             'SKIP' # nosh-run-local-syslog.install
132             'SKIP' # nosh-run-openssh-server.install
133             'SKIP' # nosh-run-suckless-mdev.install
134             'SKIP' # nosh-run-systemd-udev.install
135             'SKIP' # nosh-run-system-manager.install
136             'SKIP' # nosh-run-udev.install
137             'SKIP' # nosh-run-user-vt.install
138             'SKIP' # nosh-run-via-systemd.install
139             'SKIP' # nosh-run-virtualbox-guest.install
140             'SKIP' # nosh-service-management.install
141             )
142 validpgpkeys=()
144 prepare() {
145     
146     # ncurses headers different to Debian layout, patch out the ncursesw directory in cpp Includes
147     # taken from https://github.com/atweiden/pkgbuilds/blob/master/nosh/PKGBUILD
148         msg2 "Fix ncurses header import issues"
149     cd "${srcdir}"/source
150     find . -type f -print0 | xargs -0 sed -i 's@ncursesw/curses\.h@curses.h@g'
151     
152     # patch package/stage for Archlinux filesystem layout
153     msg2 "Align staging with Arch FS hierarchy guidelines"
154     cd "${srcdir}"
155     patch -p1 -i "${srcdir}"/staging.patch
156     
157     # patch debian maintenance scripts
158     msg2 "Adapting maintenance scripts"
159     cd "${srcdir}"/package/debian
160     sed -i 's@usr/local/lib@usr/lib@g' nosh-run-via-systemd.post_install.extra nosh-run-via-systemd.post_upgrade.extra
161     cd "${srcdir}"
162     patch -p1 -i "${srcdir}"/maintenance-scripts.patch
165 build() {
166           
167     msg2 "Building main source"
168     "${srcdir}"/package/compile
169     
170     msg2 "Generating .install files"
171     source "${srcdir}"/scriptletbuilder.sh
172     for i in ${_pkginstalls[@]}
173     do
174         echo "Bulding $i.install"
175         _buildinstall $i > $i.install
176     done
177     
178     msg2 "Staging packages"
179     # stage packages to 'staging' directory
180     "${srcdir}"/package/stage "${srcdir}" "${srcdir}"/staging
183 check() {
184     # no test available for the moment
185     msg "Checking skipped..."
188 package_nosh-common() {
189     
190     # provide license (can't be done in each package, it creates file conflicts on install)
191     install -Dm 644 "${srcdir}"/source/COPYING "${pkgdir}"/usr/share/licenses/nosh/COPYING
195 # refactor the packaging, need special case for non-conforming package
196 for _pkg in ${pkgname[@]}
198     if test "$_pkg" != "nosh-common"
199     then
200     eval "package_${_pkg}() { _package $_pkg; }"
201     fi
202 done
204 _package() {
206     case "$1" in
207         nosh-guide)
208             pkgdesc="User guide for the various nosh-* packages"
209             depends+=( 'nosh-common')
210             ;;
211         nosh-exec)
212             pkgdesc="Minimal non-shell script processor and various chain-load utilities useful for services"
213             depends+=( 'nosh-common')
214             conflicts+=( 'daemontools' 'daemontools-encore' 'nosh-bundles<=1.33')
215             ;;
216         nosh-service-management)
217             pkgdesc="Service and system management utilities"
218             depends+=( 'nosh-common' 'glibc>=2.13')
219             conflicts+=( 'nosh-bundles<=1.30' 'daemontools' 'daemontools-encore' )
220             install="nosh-service-management.install"
221             ;;
222         nosh-terminal-management)
223             pkgdesc="Virtual terminal, pseudo-terminal, and TUI login tools"
224             depends+=( 'nosh-common' 'nosh-service-management>=1.14' )
225             conflicts+=( 'nosh-bundles<=1.20')
226             ;;
227         nosh-terminal-extras)
228             pkgdesc="Extra terminal utilities"
229             depends+=( 'nosh-common' 'nosh-terminal-management' )
230             ;;
231         nosh-zsh-completion)
232             pkgdesc="Z Shell completion functions for the nosh toolset"
233             depends+=( 'nosh-common')
234             optdepends=( 'zsh: for actual ZSH support' )
235             ;;
236         nosh-systemv-shims)
237             pkgdesc="BSD and System 5 shim service and system management utilities"
238             depends+=( 'nosh-common' 'nosh-service-management' )
239             conflicts+=( 'systemd-sysvcompat')
240             ;;
241         nosh-systemd-shims)
242             pkgdesc="Systemd shim service and system management utilities"
243             depends+=( 'nosh-common' 'nosh-service-management' )
244             conflicts+=( 'systemd' )
245             ;;
246         nosh-upstart-shims)
247             pkgdesc="Upstart shim service and system management utilities"
248             depends+=( 'nosh-common' 'nosh-service-management' )
249             ;;
250         nosh-execline-shims)
251             pkgdesc="Execline utility shims"
252             depends+=( 'nosh-common' 'nosh-exec' )
253             conflicts+=( 'execline' )
254             ;;
255         nosh-core-shims)
256             pkgdesc="Core utility shims"
257             depends+=( 'nosh-common' 'nosh-exec' )
258             conflicts+=( 'coreutils' 'util-linux' )
259             ;;
260         nosh-service-command-shim)
261             pkgdesc="Shim for the old BSD and System 5 service command"
262             depends+=( 'nosh-common' 'nosh-service-management' 'nosh-systemv-shims' )
263             conflicts+=( 'systemd-sysvcompat' 'sysvinit' 'nosh-systemv-shims<=1.36')
264             ;;
265         nosh-debian-shims)
266             pkgdesc="Debian shim service and system management utilities"
267             depends+=( 'nosh-common' 'nosh-service-management' )
268             conflicts+=( 'nosh-run-via-systemd' 'upstart' 'sysvinit' 'systemd' )
269             ;;
270         nosh-openbsd-shims)
271             pkgdesc="OpenBSD shim service and system management utilities"
272             depends+=( 'nosh-common' 'nosh-service-management' 'nosh-systemv-shims>=1.28' )
273             conflicts+=( 'nosh-systemv-shims<=1.27')
274             ;;
275         nosh-freebsd-shims)
276             pkgdesc="FreeBSD shim service and system management utilities"
277             depends+=( 'nosh-terminal-management' )
278             conflicts+=( 'nosh-sistemv-shims<=1.27' )
279             ;;
280         nosh-bsd-shims)
281             pkgdesc="BSD shim service and system management utilities"
282             depends+=( 'nosh-common' 'nosh-service-management' )
283             conflicts+=( 'android-tools' )
284             ;;
285         nosh-ucspi-tcp-shims)
286             pkgdesc="Bernstein UCSPI-TCP shim service utilities"
287             depends+=( 'nosh-common' 'nosh-exec' )
288             conflicts+=( 'ucspi-tcp' 'nosh-exec<=1.32')
289             ;;
290         nosh-kbd-shims)
291             pkgdesc="Shim kbd utilities"
292             depends+=( 'nosh-common' 'nosh-terminal-management' )
293             conflicts+=( 'kbd')
294             ;;
295         #nosh-logrotate-shims)
296         #    pkgdesc="Shim for the logrotate package"
297         #    depends+=( 'nosh-common' 'nosh-bundles' )
298         #    ;;
299         nosh-bundles)
300             pkgdesc="Service bundles"
301             depends+=( 'nosh-common' 'nosh-service-management>=1.37' 'nosh-exec>=1.37' 'nosh-terminal-management>=1.22' 'shadow' )
302             install="nosh-bundles.install"
303             ;;
304         nosh-run-system-manager)
305             pkgdesc="Run the nosh system manager"
306             depends+=( 'nosh-common' 'nosh-service-management>=1.33' 'nosh-exec' 'nosh-bundles' 'redo-jdebp' )
307             conflicts+=( 'nosh-run-via-systemd' 'upstart' 'sysvinit' 'systemd-sysvcompat') #'systemd' 
308             install="nosh-run-system-manager.install"
309             ;;
310         nosh-run-debian-desktop-base)
311             pkgdesc="Run the local syslog service"
312             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles>=1.33' 'nosh-terminal-management' )
313             conflicts+=( 'nosh-run-debian-server-base' 'nosh-bundles<=1.32')
314             install="nosh-run-debian-desktop-base.install"
315             backup=( 'usr/share/system-control/presets/90-linux-static-networking.preset'
316                      'usr/share/system-control/presets/50-Debian-Server-Basic.preset'
317                      'usr/share/system-control/presets/50-Debian-Desktop-Basic.preset'
318                      'usr/share/system-control/presets/90-linux-boot-essentials.preset'
319                      'usr/share/system-control/presets/90-common-boot-essentials.preset'
320                      )
321             ;;
322         nosh-run-debian-server-base)
323             pkgdesc="Run the local syslog service"
324             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles>=1.33' 'nosh-terminal-management' )
325             conflicts+=( 'nosh-run-debian-desktop-base' 'nosh-bundles<=1.32')
326             install="nosh-run-debian-server-base.install"
327             backup=( 'usr/share/system-control/presets/90-linux-static-networking.preset'
328                      'usr/share/system-control/presets/50-Debian-Server-Basic.preset'
329                      'usr/share/system-control/presets/90-linux-boot-essentials.preset'
330                      'usr/share/system-control/presets/90-common-boot-essentials.preset'
331                      )
332             ;;
333         nosh-run-kernel-vt)
334             pkgdesc="Run old-style kernel virtual terminals"
335             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-terminal-management' 'nosh-bundles' )
336             install="nosh-run-kernel-vt.install"
337             backup=( 'usr/share/system-control/presets/80-linux-ttylogin-tty.preset'
338                      'usr/share/system-control/presets/80-enable-kernel-vt.preset'
339                      )
340             ;;
341         nosh-run-user-vt)
342             pkgdesc="Run new-style application-mode virtual terminals"
343             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-terminal-management' 'nosh-bundles' )
344             install="nosh-run-user-vt.install"
345             backup=( 'usr/share/system-control/presets/80-enable-user-vt.preset'
346                      'usr/share/system-control/presets/80-linux-ttylogin-vc.preset'
347                      )
348             ;;
349         nosh-run-via-systemd)
350             pkgdesc="Run the nosh service manager and daemontools service scanner via systemd"
351             depends+=( 'nosh-common' 'nosh-service-management>=1.33' 'systemd' 'nosh-bundles' )
352             install="nosh-run-via-systemd.install"
353             backup=( 'usr/share/system-control/presets/80-disable-sysinit.preset'
354                      'usr/share/system-control/presets/80-disable-dbus.preset'
355                      'usr/share/system-control/presets/80-disable-local-syslog.preset'
356                      'usr/share/system-control/presets/80-disable-remote-fs.preset'
357                      'usr/share/system-control/presets/80-disable-networking.preset'
358                      'usr/lib/systemd/system/service-manager-svscan.path'
359                      'usr/lib/systemd/system/system-control-normal.service'
360                      'usr/lib/systemd/system/service-manager.socket'
361                      'usr/lib/systemd/system/service-manager-svscan.service'
362                      'usr/lib/systemd/system/vc-getty@.service'
363                      'usr/lib/systemd/system/service-manager.service'
364                      'usr/lib/tmpfiles.d/terminal-emulator.conf'
365                      'usr/lib/tmpfiles.d/service-manager.conf'
366                      'usr/lib/tmpfiles.d/system-manager.conf'
367                      )
368             ;;
369         nosh-run-virtualbox-guest)
370             pkgdesc="Run VirtualBox guest additions"
371             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles' )
372             install="nosh-run-virtualbox-guest.install"
373             backup=( 'usr/share/system-control/presets/80-virtualbox-guest.preset' )
374             ;;
375         nosh-run-freedesktop-system-bus)
376             pkgdesc="Run the system-wide message bus from freedesktop.org"
377             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles' )
378             install="nosh-run-freedesktop-system-bus.install"
379             backup=('usr/share/system-control/presets/80-enable-freedesktop-system-bus.preset' )
380             ;;
381         nosh-run-freedesktop-kits)
382             pkgdesc="Run the various "kit" programs from freedesktop.org"
383             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles' )
384             install="nosh-run-freedesktop-kits.install"
385             backup=( 'usr/share/system-control/presets/40-PackageKit.preset'
386                      'usr/share/system-control/presets/40-PolicyKit.preset'
387                      'usr/share/system-control/presets/40-UPower.preset'
388                      'usr/share/system-control/presets/40-ColourManager.preset'
389                      'usr/share/system-control/presets/40-ConsoleKit.preset'
390                      'usr/share/system-control/presets/40-UDisks.preset'
391                      'usr/share/system-control/presets/40-NetworkManager.preset'
392                      'usr/share/system-control/presets/40-ModemManager.preset'
393                      'usr/share/system-control/presets/40-Avahi.preset'
394                      )
395             ;;
396         nosh-run-openssh-server)
397             pkgdesc="Run the OpenSSH server"
398             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles' )
399             install="nosh-run-openssh-server.install"
400             backup=( 'usr/share/system-control/presets/40-OpenSSHServer.preset' )
401             ;;
402         nosh-run-appletalk)
403             pkgdesc="Run the various AppleTalk service"
404             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles' )
405             backup=( 'usr/share/system-control/presets/40-AppleTalk.preset' )
406             ;;
407         nosh-run-udev)
408             pkgdesc="Run udev as the device manager"
409             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles' )
410             optdepends+=( 'eudev: alternative udev implementation' )
411             conflicts+=('nosh-run-busybox-mdev' 'nosh-run-suckless-mdev' 'nosh-run-vdev' 'nosh-run-systemd-udev')
412             install="nosh-run-udev.install"
413             backup=( 'usr/share/system-control/presets/80-enable-udev.preset' )
414             ;;
415         nosh-run-systemd-udev)
416             pkgdesc="Run systemd-udev as the device manager"
417             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles>=1.34' 'systemd')
418             conflicts+=('nosh-run-busybox-mdev' 'nosh-run-suckless-mdev' 'nosh-run-vdev' 'nosh-run-udev')
419             install="nosh-run-systemd-udev.install"
420             backup=( 'usr/share/system-control/presets/80-enable-systemd-udev.preset' )
421             ;;
422         nosh-run-busybox-mdev)
423             pkgdesc="Run BusyBox mdev as the device manager"
424             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles' 'busybox')
425             conflicts+=('nosh-run-udev' 'nosh-run-suckless-mdev' 'nosh-run-vdev' 'nosh-run-systemd-udev')
426             install="nosh-run-busybox-mdev.install"
427             backup=( 'usr/share/system-control/presets/80-enable-busybox-mdev.preset' )
428             ;;
429         nosh-run-suckless-mdev)
430             pkgdesc="Run SuckLess mdev as the device manager"
431             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles' 'smdev')
432             conflicts+=('nosh-run-udev' 'nosh-run-busybox-mdev' 'nosh-run-vdev' 'nosh-run-systemd-udev')
433             install="nosh-run-suckless-mdev.install"
434             backup=( 'usr/share/system-control/presets/80-enable-suckless-mdev.preset' )
435             ;;
436         nosh-run-vdev)
437             pkgdesc="Run vdev as the device manager"
438             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management' 'nosh-bundles' 'vdev-git')
439             conflicts+=('nosh-run-busybox-mdev' 'nosh-run-suckless-mdev' 'nosh-run-udev' 'nosh-run-systemd-udev')
440             # no run script so far
441             # install="nosh-run-vdev.install"
442             backup=( 'usr/share/system-control/presets/80-enable-vdev.preset' )
443             ;;
444         nosh-run-local-syslog)
445             pkgdesc="Run the local syslog service"
446             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles' )
447             #conflicts+=( 'systemd' )
448             install="nosh-run-local-syslog.install"
449             backup=( 'usr/share/system-control/presets/80-enable-local-syslog.preset' )
450             ;;
451         nosh-run-klog)
452             pkgdesc="Run the klog service"
453             depends+=( 'nosh-common' 'nosh-exec' 'nosh-service-management>=1.33' 'nosh-bundles' )
454             #conflicts+=( 'systemd' )
455             install="nosh-run-klog.install"
456             backup=( 'usr/share/system-control/presets/80-enable-klog.preset' )
457             ;;
458     esac
459     
460     # copy over the staging files
461     (cd "${srcdir}"/staging/"${1}"/ && pax -r -w -l -- * "${pkgdir}"/)
462