Fixes and pkgrel bump
[archnosh.git] / scriptletbuilder.sh
blob76b7b7d96765c1f83effd7ac6286b0b064d8f28c
1 #!/bin/sh -e
2 # builds the Archlinux .install script for a package
3 # if a <package>.(pre_|post_)(install|upgrade|remove) file exists, use it directly
4 # if a <package>.p file exists, use the corresponding utility .funcs
5 # adding the <package>.(pre_|post_)(install|upgrade|remove).extra if they exist
7 _buildinstall() {
9 local pkgpath="${srcdir}"/package/debian
11 for j in install upgrade remove
13 for k in pre_ post_
15 s="$k$j"
16 if test -r $pkgpath/"$1"."$s" # specific install script
17 then
18 echo "$s() {"
19 echo
20 sed -e 's/^/ /' $pkgpath/"$1"."$s"
21 echo
22 echo "}"
23 echo
24 elif test -r $pkgpath/"$1".p # bundle-based install
25 then
26 if test -r $pkgpath/"$s".funcs
27 then
28 echo "$s() {"
29 echo
30 if >/dev/null expr "$1" : "nosh-run-"
31 then
32 echo " nosh_run_package=YES"
33 echo
35 sed -e 's/^/ /' $pkgpath/"$s".funcs
36 echo
37 if test -r $pkgpath/"$1"."$s".extra # additional instructions
38 then
39 sed -e 's/^/ /' $pkgpath/"$1"."$s".extra
41 echo
42 sed -e 's/^/ /' $pkgpath/"$1".p
43 echo
44 echo "}"
45 echo
48 done
49 done