0682b80a1d
packaging - simplify script macros: make ghc_preinst_script and ghc_postun_script no-ops and ghc_preun_script only unregister for uninstall
24 lines
604 B
Bash
Executable File
24 lines
604 B
Bash
Executable File
#!/bin/sh
|
|
|
|
[ $# -ne 1 ] && echo "Usage: $0 lib-ver[.tar.gz]" && exit 1
|
|
|
|
INPUT=$1
|
|
|
|
case $INPUT in
|
|
*/*) INPUT=$(basename $INPUT) ;;
|
|
esac
|
|
|
|
INPUT=$(echo $INPUT | sed -e "s/.tar.gz//")
|
|
|
|
VERSION=$(echo $INPUT | sed -e "s/[A-Za-z-]*-//")
|
|
|
|
NAME=$(echo $INPUT | sed -e "s/-$VERSION//")
|
|
|
|
[ -r ghc-$NAME.spec ] && echo "ghc-$NAME.spec already exists!" && exit 1
|
|
|
|
cp /usr/share/ghc/cabal-lib-template.spec ghc-$NAME.spec
|
|
|
|
echo "created ghc-$NAME.spec"
|
|
|
|
sed -i -e "s/@PACKAGE@/$NAME/" -e "s/@GHC_VERSION@/$(ghc --numeric-version)/" -e "s/@VERSION@/$VERSION/" -e "s/@DATE@/`date +\"%a %b %e %Y\"`/" ghc-$NAME.spec
|