--- trunk/mage/usr/share/doc/mage/template.smage2 2012/01/13 13:32:22 1636 +++ trunk/mage/usr/share/doc/mage/template.smage2 2012/01/13 18:20:13 1637 @@ -1,38 +1,159 @@ # smage-script for app-dir/foobar +# +# The filename must correspond to these settings. +# This file must be named to foobar-1.2.3.5-r1.smage2 +# PNAME="foobar" PVER="1.2.3.5" PBUILD="r1" +# +# A list of valid categories can by found in the mage-profile +# +PCAT="sys-apps" +# +# deprecated and gets dropped in the future, so please use PCAT +#PCATEGORIE="sys-apps" + +# +# State of the package. Can be set to 'stable', 'testing' and 'unstable' +# This variable does not need be set in every package, +# the distribution file of the repository is preferred. +# Only set global overrides here. +# +STATE="unstable" + +# +# Sets the licenses of the package-source. +# This can be set to more than one. +# All supported licenses can be found at /usr/share/licenses +# +LICENSE="gpl-2 lgpl" + +# +# Source filename and location of the builddir +# SRCFILE="${PNAME}-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" -#prevents to build a package (needed for sources) -#NOPKGBUILD=true - -src_prepare() { +# +# Set some nifty mage-features at compile time. +# See /etc/mage.rc.global for further details. +# +msetfeature "libtool" "!strip" "!distcc" "check" + +# +# You may want to pull in some includes. +# See ${SMAGESCRIPTSDIR}/includes for further details. +# +sminclude mtools + +# +# All download uris needed by the package. +# +SRC_URI=( + http://${PNAME}.org/${SRCILE} + mirror://${PNAME}/${SRCFILE} + mirror://${PNAME}/${PNAME}-${PVER}-foo.patch +) + +# +# Unpacks and prepare the source for compilation. +# Patches and fixes goes here too. +# +src_prepare() +{ munpack ${SRCFILE} || die cd ${SRCDIR} - #patch something - mpatch -Np1 foo.patch || die - + # Apply a patch. + mpatch ${PNAME}-${PVER}-foo.patch || die } -src_compile() { +# +# All tasks to compile the source are in this function. +# +src_compile() +{ cd ${SRCDIR} mconfigure || die mmake || die } -src_install() { +# +# Run checks after compilation to find build errors. +# Most packages includes a testsuite. +# +src_check() +{ + cd ${SRCDIR} + mmake -k check || die +} + +# +# Everything which is needed to install a packages +# should be run here. +# +src_install() +{ cd ${SRCDIR} - - minstall || die + mmake DESTDIR=${BINDIR} install || die + + # Alternative if a Makefile does not support DESTDIR. + # The PREFIX variable gets expanded by BINDIR. + # But you should try to use the DESTDIR directive. + #minstall || die + + # Install some included docs. + minstalldocs AUTHOR BUGS COPYING TODO || die +} + +preinstall() +{ + echo "Running preinstall ..." + + echo "You should add users here" + mgroupadd groupname + museradd username +} - #alternative - #make DESTDIR=${BINDIR} install || die +postinstall() +{ + echo "Running postinstall ..." + + echo "Services should be started here using the mtools functions" + # SysV Init/busybox + mstartservice sshd + # systemd + mstartunit sshd.service + + echo "Some dependent services might get reloaded as well, like dbus" + # SysV Init/busybox + mreloadservice dbus + # systemd + mreloadunit dbus +} + +preremove() +{ + echo "Running preremove ..." +} - minstalldocs AUTHOR BUGS TODO +postremove() +{ + echo "Running postinstall ..." + + echo "Services should be stopped here using the mtools functions" + # SysV Init/busybox + mstopservice sshd + # systemd + mstopunit sshd.service + + echo "Some dependent services might get reloaded as well, like dbus" + # SysV Init/busybox + mreloadservice dbus + # systemd + mreloadunit dbus }