1 |
# smage-script for app-dir/foobar |
# smage-script for app-dir/foobar |
2 |
|
|
3 |
|
# |
4 |
|
# The filename must correspond to these settings. |
5 |
|
# This file must be named to foobar-1.2.3.5-r1.smage2 |
6 |
|
# |
7 |
PNAME="foobar" |
PNAME="foobar" |
8 |
PVER="1.2.3.5" |
PVER="1.2.3.5" |
9 |
PBUILD="r1" |
PBUILD="r1" |
10 |
|
|
11 |
|
# |
12 |
|
# A list of valid categories can by found in the mage-profile |
13 |
|
# |
14 |
|
PCAT="sys-apps" |
15 |
|
# |
16 |
|
# deprecated and gets dropped in the future, so please use PCAT |
17 |
|
#PCATEGORIE="sys-apps" |
18 |
|
|
19 |
|
# |
20 |
|
# State of the package. Can be set to 'stable', 'testing' and 'unstable' |
21 |
|
# This variable does not need be set in every package, |
22 |
|
# the distribution file of the repository is preferred. |
23 |
|
# Only set global overrides here. |
24 |
|
# |
25 |
|
STATE="unstable" |
26 |
|
|
27 |
|
# |
28 |
|
# Sets the licenses of the package-source. |
29 |
|
# This can be set to more than one. |
30 |
|
# All supported licenses can be found at /usr/share/licenses |
31 |
|
# |
32 |
|
LICENSE="gpl-2 lgpl" |
33 |
|
|
34 |
|
# |
35 |
|
# Source filename and location of the builddir |
36 |
|
# |
37 |
SRCFILE="${PNAME}-${PVER}.tar.bz2" |
SRCFILE="${PNAME}-${PVER}.tar.bz2" |
38 |
SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
39 |
|
|
40 |
#NOPKGBUILD=true |
# |
41 |
|
# Set some nifty mage-features at compile time. |
42 |
src_prepare() { |
# See /etc/mage.rc.global for further details. |
43 |
|
# |
44 |
|
msetfeature "libtool" "!strip" "!distcc" "check" |
45 |
|
|
46 |
|
# |
47 |
|
# You may want to pull in some includes. |
48 |
|
# See ${SMAGESCRIPTSDIR}/includes for further details. |
49 |
|
# |
50 |
|
sminclude mtools |
51 |
|
|
52 |
|
# |
53 |
|
# All download uris needed by the package. |
54 |
|
# |
55 |
|
SRC_URI=( |
56 |
|
http://${PNAME}.org/${SRCILE} |
57 |
|
mirror://${PNAME}/${SRCFILE} |
58 |
|
mirror://${PNAME}/${PNAME}-${PVER}-foo.patch |
59 |
|
) |
60 |
|
|
61 |
|
# |
62 |
|
# Unpacks and prepare the source for compilation. |
63 |
|
# Patches and fixes goes here too. |
64 |
|
# |
65 |
|
src_prepare() |
66 |
|
{ |
67 |
munpack ${SRCFILE} || die |
munpack ${SRCFILE} || die |
68 |
cd ${SRCDIR} |
cd ${SRCDIR} |
69 |
|
|
70 |
#patch something |
# Apply a patch. |
71 |
mpatch -Np1 foo.patch || die |
mpatch ${PNAME}-${PVER}-foo.patch || die |
|
|
|
72 |
} |
} |
73 |
|
|
74 |
src_compile() { |
# |
75 |
|
# All tasks to compile the source are in this function. |
76 |
|
# |
77 |
|
src_compile() |
78 |
|
{ |
79 |
cd ${SRCDIR} |
cd ${SRCDIR} |
80 |
|
|
81 |
mconfigure || die |
mconfigure || die |
82 |
mmake || die |
mmake || die |
83 |
} |
} |
84 |
|
|
85 |
src_install() { |
# |
86 |
|
# Run checks after compilation to find build errors. |
87 |
|
# Most packages includes a testsuite. |
88 |
|
# |
89 |
|
src_check() |
90 |
|
{ |
91 |
|
cd ${SRCDIR} |
92 |
|
mmake -k check || die |
93 |
|
} |
94 |
|
|
95 |
|
# |
96 |
|
# Everything which is needed to install a packages |
97 |
|
# should be run here. |
98 |
|
# |
99 |
|
src_install() |
100 |
|
{ |
101 |
cd ${SRCDIR} |
cd ${SRCDIR} |
102 |
|
mmake DESTDIR=${BINDIR} install || die |
103 |
minstall || die |
|
104 |
|
# Alternative if a Makefile does not support DESTDIR. |
105 |
|
# The PREFIX variable gets expanded by BINDIR. |
106 |
|
# But you should try to use the DESTDIR directive. |
107 |
|
#minstall || die |
108 |
|
|
109 |
|
# Install some included docs. |
110 |
|
minstalldocs AUTHOR BUGS COPYING TODO || die |
111 |
|
} |
112 |
|
|
113 |
|
preinstall() |
114 |
|
{ |
115 |
|
echo "Running preinstall ..." |
116 |
|
|
117 |
|
echo "You should add users here" |
118 |
|
mgroupadd groupname |
119 |
|
museradd username |
120 |
|
} |
121 |
|
|
122 |
#alternative |
postinstall() |
123 |
#make DESTDIR=${BINDIR} install || die |
{ |
124 |
|
echo "Running postinstall ..." |
125 |
|
|
126 |
|
echo "Services should be started here using the mtools functions" |
127 |
|
# SysV Init/busybox |
128 |
|
mstartservice sshd |
129 |
|
# systemd |
130 |
|
mstartunit sshd.service |
131 |
|
|
132 |
|
echo "Some dependent services might get reloaded as well, like dbus" |
133 |
|
# SysV Init/busybox |
134 |
|
mreloadservice dbus |
135 |
|
# systemd |
136 |
|
mreloadunit dbus |
137 |
|
} |
138 |
|
|
139 |
|
preremove() |
140 |
|
{ |
141 |
|
echo "Running preremove ..." |
142 |
|
} |
143 |
|
|
144 |
minstalldocs AUTHOR BUGS TODO |
postremove() |
145 |
|
{ |
146 |
|
echo "Running postinstall ..." |
147 |
|
|
148 |
|
echo "Services should be stopped here using the mtools functions" |
149 |
|
# SysV Init/busybox |
150 |
|
mstopservice sshd |
151 |
|
# systemd |
152 |
|
mstopunit sshd.service |
153 |
|
|
154 |
|
echo "Some dependent services might get reloaded as well, like dbus" |
155 |
|
# SysV Init/busybox |
156 |
|
mreloadservice dbus |
157 |
|
# systemd |
158 |
|
mreloadunit dbus |
159 |
} |
} |