Revision f13b7e71
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
DEBIAN/DEBIAN/postinst | ||
---|---|---|
|
||
config_postgresql_factory_script() {
|
||
|
||
echo "Starting factory postgresql config script: scripts/inst_postgres_deb.sh.."
|
||
cd /usr/lib/lx-office-erp/
|
||
./scripts/inst_postgres_deb.sh
|
||
echo "Factory postgresql config script done."
|
||
echo "Starting factory postgresql config script: scripts/inst_postgres_deb.sh.."
|
||
cd /usr/lib/lx-office-erp/
|
||
./scripts/inst_postgres_deb.sh
|
||
echo "Factory postgresql config script done."
|
||
}
|
||
|
||
|
||
set_lx_office_erp_web_admin_password() {
|
||
db_get lx-office-erp/admin-password
|
||
ADMINPASSWORD="$RET"
|
||
db_get lx-office-erp/admin-password
|
||
ADMINPASSWORD="$RET"
|
||
|
||
sed --in-place --expression "s/^admin_password.*=.*/admin_password = $ADMINPASSWORD/" /etc/lx-office-erp/lx_office.conf
|
||
sed --in-place --expression "s/^admin_password.*=.*/admin_password = $ADMINPASSWORD/" /etc/lx-office-erp/lx_office.conf
|
||
}
|
||
|
||
|
||
set_lx_office_erp_authentication_db_user_password() {
|
||
db_get lx-office-erp/lx-office-erp-user-postgresql-password
|
||
PASSWORD="$RET"
|
||
db_get lx-office-erp/lx-office-erp-user-postgresql-password
|
||
PASSWORD="$RET"
|
||
|
||
sed --in-place --expression "s/^password.*=.*/password = $PASSWORD/" /etc/lx-office-erp/lx_office.conf
|
||
sed --in-place --expression "s/^user.*=.*postgres/user = lxoffice/g" /etc/lx-office-erp/lx_office.conf
|
||
sed --in-place --expression "s/^password.*=.*/password = $PASSWORD/" /etc/lx-office-erp/lx_office.conf
|
||
sed --in-place --expression "s/^user.*=.*postgres/user = lxoffice/g" /etc/lx-office-erp/lx_office.conf
|
||
}
|
||
|
||
|
||
set_user_rights() {
|
||
chown -R www-data:www-data /usr/lib/lx-office-erp/users
|
||
chown -R www-data:www-data /usr/lib/lx-office-erp/templates
|
||
chown www-data:www-data /etc/lx-office-erp/lx_office.conf
|
||
chown www-data:www-data /usr/lib/lx-office-erp/menu.ini
|
||
chmod 0600 /etc/lx-office-erp/lx_office.conf
|
||
chown -R www-data:www-data /usr/lib/lx-office-erp/users
|
||
chown -R www-data:www-data /usr/lib/lx-office-erp/templates
|
||
chown www-data:www-data /etc/lx-office-erp/lx_office.conf
|
||
chown www-data:www-data /usr/lib/lx-office-erp/menu.ini
|
||
chmod 0600 /etc/lx-office-erp/lx_office.conf
|
||
}
|
||
|
||
mk_new_menu() {
|
||
if [ -e /usr/lib/lx-office-crm ] ; then
|
||
if [ -e /usr/lib/lx-office-crm ] ; then
|
||
#crm vorhanden, dann die menu.ini mit der höchsten VersNr nehmen
|
||
for i in `ls -1 /usr/lib/lx-office-crm/update/menu*ini` ; do
|
||
cat $i > /usr/lib/lx-office-erp/menu.ini
|
||
done;
|
||
cat /usr/lib/lx-office-erp/menu.default >> /usr/lib/lx-office-erp/menu.ini
|
||
else
|
||
cp /usr/lib/lx-office-erp/menu.default /usr/lib/lx-office-erp/menu.ini
|
||
fi
|
||
for i in `ls -1 /usr/lib/lx-office-crm/update/menu*ini` ; do
|
||
cat $i > /usr/lib/lx-office-erp/menu.ini
|
||
done;
|
||
cat /usr/lib/lx-office-erp/menu.default >> /usr/lib/lx-office-erp/menu.ini
|
||
else
|
||
cp /usr/lib/lx-office-erp/menu.default /usr/lib/lx-office-erp/menu.ini
|
||
fi
|
||
}
|
||
|
||
mk_new_config() {
|
||
if ! [ -f /etc/lx-office-erp/lx_office.conf ] ; then
|
||
cp /etc/lx-office-erp/lx_office.conf.default /etc/lx-office-erp/lx_office.conf
|
||
fi
|
||
if ! [ -f /etc/lx-office-erp/lx_office.conf ] ; then
|
||
cp /etc/lx-office-erp/lx_office.conf.default /etc/lx-office-erp/lx_office.conf
|
||
fi
|
||
}
|
||
|
||
mk_links() {
|
||
for file in lx_office.conf lx_office.conf.default ; do
|
||
test -f /usr/lib/lx-office-erp/config/${file} || ln -s /etc/lx-office-erp/${file} /usr/lib/lx-office-erp/config/${file}
|
||
done
|
||
if [ -e /etc/apache2 ] ; then
|
||
if ! [ -f /etc/apache2/conf.d/lx-office-erp.apache2.conf ] ; then
|
||
ln -s /etc/lx-office-erp/lx-office-erp.apache2.conf /etc/apache2/conf.d/lx-office-erp.apache2.conf
|
||
fi;
|
||
for file in lx_office.conf lx_office.conf.default ; do
|
||
test -f /usr/lib/lx-office-erp/config/${file} || ln -s /etc/lx-office-erp/${file} /usr/lib/lx-office-erp/config/${file}
|
||
done
|
||
if [ -e /etc/apache2 ] ; then
|
||
if ! [ -f /etc/apache2/conf.d/lx-office-erp.apache2.conf ] ; then
|
||
ln -s /etc/lx-office-erp/lx-office-erp.apache2.conf /etc/apache2/conf.d/lx-office-erp.apache2.conf
|
||
fi;
|
||
if [ -e /etc/cherokee/sites-available ] ; then
|
||
if ! [ -f /etc/cherokee/sites-available/lx-office-erp.cherokee ] ; then
|
||
cat /etc/lx-office-erp/lx-office-erp.cherokee.handler >> /etc/cherokee/sites-available/default
|
||
ln -s /etc/lx-office-erp/lx-office-erp.cherokee /etc/cherokee/sites-available/lx-office-erp.cherokee
|
||
fi;
|
||
fi;
|
||
if [ -e /etc/cherokee/sites-available ] ; then
|
||
if ! [ -f /etc/cherokee/sites-available/lx-office-erp.cherokee ] ; then
|
||
cat /etc/lx-office-erp/lx-office-erp.cherokee.handler >> /etc/cherokee/sites-available/default
|
||
ln -s /etc/lx-office-erp/lx-office-erp.cherokee /etc/cherokee/sites-available/lx-office-erp.cherokee
|
||
fi;
|
||
if [ -e /etc/lighttpd ] ; then
|
||
if ! [ -f /etc/lighttpd/conf-enabled/lx-office-erp.lighttpd ] ; then
|
||
ln -s /etc/lx-office-erp/lx-office-erp.lighttpd /etc/lighttpf/conf-enabled/10-lx-office-erp
|
||
fi;
|
||
fi;
|
||
if [ -e /etc/lighttpd ] ; then
|
||
if ! [ -f /etc/lighttpd/conf-enabled/lx-office-erp.lighttpd ] ; then
|
||
ln -s /etc/lx-office-erp/lx-office-erp.lighttpd /etc/lighttpf/conf-enabled/10-lx-office-erp
|
||
fi;
|
||
fi;
|
||
}
|
||
reload_web_server() {
|
||
if [ -f /etc/init.d/apache* ] ; then
|
||
/etc/init.d/apache* reload
|
||
fi
|
||
if [ -f /etc/init.d/cherokee ] ; then
|
||
/etc/init.d/cherokee reload
|
||
fi
|
||
if [ -f /etc/init.d/lighttpd ] ; then
|
||
/etc/init.d/lighttpd reload
|
||
fi
|
||
if [ -f /etc/init.d/apache* ] ; then
|
||
/etc/init.d/apache* reload
|
||
fi
|
||
if [ -f /etc/init.d/cherokee ] ; then
|
||
/etc/init.d/cherokee reload
|
||
fi
|
||
if [ -f /etc/init.d/lighttpd ] ; then
|
||
/etc/init.d/lighttpd reload
|
||
fi
|
||
}
|
||
case "$1" in
|
||
|
||
upgrade)
|
||
echo " ! "`date`" $1 !" >> $debugfile
|
||
|
||
VER=`cat /var/www/lx-office-erp/VERSION | cut -d '.' -f2`
|
||
if [ $VER = '6' ]; then
|
||
echo " ! 2.6 !" >> $debugfile
|
||
echo "Version 2.6.x"
|
||
mk_new_menu
|
||
else
|
||
mk_new_menu
|
||
mk_new_config
|
||
config_postgresql_factory_script
|
||
set_lx_office_erp_web_admin_password
|
||
set_lx_office_erp_authentication_db_user_password
|
||
mk_links
|
||
fi;
|
||
|
||
set_user_rights
|
||
reload_web_server
|
||
upgrade)
|
||
echo " ! "`date`" $1 !" >> $debugfile
|
||
|
||
VER=`cat /var/www/lx-office-erp/VERSION | cut -d '.' -f2`
|
||
if [ $VER = '6' ]; then
|
||
echo " ! 2.6 !" >> $debugfile
|
||
echo "Version 2.6.x"
|
||
mk_new_menu
|
||
else
|
||
mk_new_menu
|
||
mk_new_config
|
||
config_postgresql_factory_script
|
||
set_lx_office_erp_web_admin_password
|
||
set_lx_office_erp_authentication_db_user_password
|
||
mk_links
|
||
fi;
|
||
|
||
set_user_rights
|
||
reload_web_server
|
||
;;
|
||
|
||
install|configure)
|
||
echo " ! "`date`" $1 !" >> $debugfile
|
||
install|configure)
|
||
echo " ! "`date`" $1 !" >> $debugfile
|
||
|
||
mk_new_menu
|
||
mk_new_config
|
||
config_postgresql_factory_script
|
||
set_lx_office_erp_web_admin_password
|
||
set_lx_office_erp_authentication_db_user_password
|
||
mk_links
|
||
mk_new_menu
|
||
mk_new_config
|
||
config_postgresql_factory_script
|
||
set_lx_office_erp_web_admin_password
|
||
set_lx_office_erp_authentication_db_user_password
|
||
mk_links
|
||
|
||
set_user_rights
|
||
reload_web_server
|
||
set_user_rights
|
||
reload_web_server
|
||
|
||
;;
|
||
|
||
abort-upgrade|abort-remove|abort-deconfigure)
|
||
abort-upgrade|abort-remove|abort-deconfigure)
|
||
;;
|
||
|
||
*)
|
||
echo "postinst called with unknown argument \`$1'" >&2
|
||
exit 1
|
||
*)
|
||
echo "postinst called with unknown argument \`$1'" >&2
|
||
exit 1
|
||
;;
|
||
esac
|
||
|
Auch abrufbar als: Unified diff
Kosmetik: einheitliche Einrückung