github.com/mmatczuk/gohan@v0.0.0-20170206152520-30e45d9bdb69/packager/debian/postinst (about) 1 #!/bin/sh 2 3 set -e 4 5 # summary of how this script can be called: 6 # * <postinst> `configure' <most-recently-configured-version> 7 # * <old-postinst> `abort-upgrade' <new version> 8 # * <conflictor's-postinst> `abort-remove' `in-favour' <package> 9 # <new-version> 10 # * <postinst> `abort-remove' 11 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour' 12 # <failed-install-package> <version> `removing' 13 # <conflicting-package> <version> 14 # for details, see http://www.debian.org/doc/debian-policy/ or 15 # the debian-policy package 16 17 APP_NAME="gohan" 18 CLI="${APP_NAME}" 19 APP_USER="gohan" 20 APP_GROUP="gohan" 21 APP_ETC="/etc/${APP_NAME}" 22 APP_CONFIG="${APP_ETC}/gohan.yaml" 23 APP_OPT="/opt/gohan" 24 25 # source debconf library 26 . /usr/share/debconf/confmodule 27 28 case "$1" in 29 30 configure) 31 mkdir -p ${APP_ETC} 32 chown ${APP_USER}.${APP_GROUP} ${APP_ETC} 33 [ -f ${APP_CONFIG} ] || cp -R /opt/gohan/etc/* ${APP_ETC} 34 35 cp ${APP_OPT}/packager/gohan.conf /etc/init 36 ;; 37 38 abort-upgrade|abort-remove|abort-deconfigure) 39 exit 0 40 ;; 41 42 *) 43 echo "postinst called with unknown argument \`$1'" >&2 44 exit 1 45 ;; 46 esac