source: lmd/trunk/fuentes/debian/lmd-server.postinst @ 5108

Last change on this file since 5108 was 5108, checked in by hectorgh, 4 years ago

read changelog

File size: 3.3 KB
Line 
1#!/bin/sh
2# postinst script for lmd-server
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <postinst> `configure' <most-recently-configured-version>
10#        * <old-postinst> `abort-upgrade' <new version>
11#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12#          <new-version>
13#        * <postinst> `abort-remove'
14#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15#          <failed-install-package> <version> `removing'
16#          <conflicting-package> <version>
17# for details, see http://www.debian.org/doc/debian-policy/ or
18# the debian-policy package
19
20
21case "$1" in
22    configure)
23        #if [ ! -L "/var/www/ipxeboot" ] ; then
24        #       ln -s /usr/share/lmd-server/www-boot /var/www/ipxeboot
25        #fi
26        # enable site
27
28        #if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
29        #       . /usr/share/apache2/apache2-maintscript-helper
30        #       apache2_invoke ensite ipxeboot
31        #fi
32
33       
34        #invoke-rc.d apache2 reload || true
35        n4d-modules enable-plugin /etc/n4d/conf.d/LmdServer || true
36        n4d-modules enable-plugin /etc/n4d/conf.d/LmdImageManager || true
37        n4d-modules enable-plugin /etc/n4d/conf.d/LmdTemplateManager || true
38        n4d-modules enable-plugin /etc/n4d/conf.d/LmdBootManager || true
39        n4d-modules enable-plugin /etc/n4d/conf.d/LmdClientManager || true
40        set +e
41        if [ -e '/var/lib/tftpboot/ltsp/lts.conf' ]; then
42                rc=$(grep "LDM_LANGUAGE" /var/lib/tftpboot/ltsp/lts.conf; echo $?)
43                if [ "$rc" = "1" ]; then
44                        DefaultKey=$(grep -i "\[default\]" /var/lib/tftpboot/ltsp/lts.conf | sed -e "s/\[/\\\[/g" | sed -e "s/\]/\\\]/g")
45                        sed --follow-symlinks -i -e "s/$DefaultKey/$DefaultKey\nLDM_LANGUAGE=\"es_ES.UTF-8\"/g" /var/lib/tftpboot/ltsp/lts.conf
46                fi
47                rc=$(grep "TIMEZONE" /var/lib/tftpboot/ltsp/lts.conf > /dev/null; echo $?)
48                if [ "$rc" = "1" ]; then
49                        if [ -e "/etc/timezone" ]; then
50                                TZ=$(cat /etc/timezone)
51                                echo -e "\n# Server timezone\nTIMEZONE = \"$TZ\"" >> /var/lib/tftpboot/ltsp/lts.conf
52                        fi
53                fi
54        fi
55        set -e
56        mkdir -p /etc/ldm || true
57        if [ ! -e /etc/ldm/ldminfod-locale-whitelist ]; then 
58                cp /usr/share/lmd-server/lmd-server-config/ldminfod-locale-whitelist /etc/ldm/ || true
59        fi
60        #echo "Restarting dnsmasq"
61        #invoke-rc.d dnsmasq restart || true
62
63        PKG="lmd-server"
64
65        ORIGINAL_FILE="/etc/ltsp/ltsp-update-image.excludes"
66        NEW_DIVERTED_FILE="/etc/ltsp/ltsp-update-image.excludes.diverted"
67        LLIUREX_FILE="/etc/ltsp/ltsp-update-image.excludes.lliurex"
68
69        if [ ! -L "$ORIGINAL_FILE" ]; then
70
71                dpkg-divert --add --package ${PKG} --rename --divert "$NEW_DIVERTED_FILE" "$ORIGINAL_FILE"
72                ln -s "$LLIUREX_FILE" "$ORIGINAL_FILE"
73
74        fi
75
76
77
78    ;;
79
80    abort-upgrade|abort-remove|abort-deconfigure)
81    ;;
82
83    *)
84        echo "postinst called with unknown argument \`$1'" >&2
85        exit 1
86    ;;
87esac
88
89# Copy lts.conf template to $tftproot/ltsp
90test -f /var/lib/tftpboot/ltsp/i386/lts.conf || cp /usr/share/lmd-server/templates/lts.conf /var/lib/tftpboot/ltsp/i386/
91# And lts.default.conf, for further lts.confs creation
92test -f /var/lib/tftpboot/ltsp/i386/lts.default.conf || cp /usr/share/lmd-server/templates/lts.conf /var/lib/tftpboot/ltsp/i386/lts.default.conf
93
94
95# dh_installdeb will replace this with shell code automatically
96# generated by other debhelper scripts.
97
98#DEBHELPER#
99
100exit 0
Note: See TracBrowser for help on using the repository browser.