xref: /aosp_15_r20/external/libconfig/contrib/ls-config/debian/postinst (revision 2e9d491483b805f09ea864149eadd5680efcc72a)
1*2e9d4914SAndroid Build Coastguard Worker#!/bin/sh
2*2e9d4914SAndroid Build Coastguard Worker# postinst script for ls-config
3*2e9d4914SAndroid Build Coastguard Worker#
4*2e9d4914SAndroid Build Coastguard Worker# see: dh_installdeb(1)
5*2e9d4914SAndroid Build Coastguard Worker
6*2e9d4914SAndroid Build Coastguard Workerset -e
7*2e9d4914SAndroid Build Coastguard Worker
8*2e9d4914SAndroid Build Coastguard Worker# summary of how this script can be called:
9*2e9d4914SAndroid Build Coastguard Worker#        * <postinst> `configure' <most-recently-configured-version>
10*2e9d4914SAndroid Build Coastguard Worker#        * <old-postinst> `abort-upgrade' <new version>
11*2e9d4914SAndroid Build Coastguard Worker#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12*2e9d4914SAndroid Build Coastguard Worker#          <new-version>
13*2e9d4914SAndroid Build Coastguard Worker#        * <postinst> `abort-remove'
14*2e9d4914SAndroid Build Coastguard Worker#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15*2e9d4914SAndroid Build Coastguard Worker#          <failed-install-package> <version> `removing'
16*2e9d4914SAndroid Build Coastguard Worker#          <conflicting-package> <version>
17*2e9d4914SAndroid Build Coastguard Worker# for details, see http://www.debian.org/doc/debian-policy/ or
18*2e9d4914SAndroid Build Coastguard Worker# the debian-policy package
19*2e9d4914SAndroid Build Coastguard Worker
20*2e9d4914SAndroid Build Coastguard Workerconfig_path() {
21*2e9d4914SAndroid Build Coastguard Worker    local CHK="$(echo ":$PATH:" | grep ":/usr/share/ls/lib:")"
22*2e9d4914SAndroid Build Coastguard Worker    if [ "$CHK" != "" ]; then
23*2e9d4914SAndroid Build Coastguard Worker	return 0;
24*2e9d4914SAndroid Build Coastguard Worker    fi;
25*2e9d4914SAndroid Build Coastguard Worker    local BIFS="$IFS"
26*2e9d4914SAndroid Build Coastguard Worker    IFS=$'\n'
27*2e9d4914SAndroid Build Coastguard Worker    local PR="$(</etc/profile)"
28*2e9d4914SAndroid Build Coastguard Worker    local NF=""
29*2e9d4914SAndroid Build Coastguard Worker    local L
30*2e9d4914SAndroid Build Coastguard Worker    for L in $PR
31*2e9d4914SAndroid Build Coastguard Worker    do
32*2e9d4914SAndroid Build Coastguard Worker	CHK="$(echo "$L" | sed -E 's/^([\ \t]+)//g')"
33*2e9d4914SAndroid Build Coastguard Worker	CHK="${CHK:0:5}"
34*2e9d4914SAndroid Build Coastguard Worker	NF="$NF$IFS$L"
35*2e9d4914SAndroid Build Coastguard Worker	if [ "$CHK" = "PATH=" ]; then
36*2e9d4914SAndroid Build Coastguard Worker	    NF="$NF$IFS#Configuration path for ls scripting"
37*2e9d4914SAndroid Build Coastguard Worker	    NF="$NF$IFS"
38*2e9d4914SAndroid Build Coastguard Worker	    NF="${NF}PATH=\"\$PATH:/usr/share/ls/lib\"$IFS"
39*2e9d4914SAndroid Build Coastguard Worker	fi;
40*2e9d4914SAndroid Build Coastguard Worker    done
41*2e9d4914SAndroid Build Coastguard Worker    NF="$NF$IFS"
42*2e9d4914SAndroid Build Coastguard Worker    IFS="$BIFS"
43*2e9d4914SAndroid Build Coastguard Worker    echo "$NF" > /etc/profile
44*2e9d4914SAndroid Build Coastguard Worker}
45*2e9d4914SAndroid Build Coastguard Worker
46*2e9d4914SAndroid Build Coastguard Workercase "$1" in
47*2e9d4914SAndroid Build Coastguard Worker    configure)
48*2e9d4914SAndroid Build Coastguard Worker	if [ ! -e "/etc/ls" ]; then
49*2e9d4914SAndroid Build Coastguard Worker	    mkdir -p "/etc/ls/"
50*2e9d4914SAndroid Build Coastguard Worker	    config_path
51*2e9d4914SAndroid Build Coastguard Worker	fi;
52*2e9d4914SAndroid Build Coastguard Worker    ;;
53*2e9d4914SAndroid Build Coastguard Worker
54*2e9d4914SAndroid Build Coastguard Worker    abort-upgrade|abort-remove|abort-deconfigure)
55*2e9d4914SAndroid Build Coastguard Worker    ;;
56*2e9d4914SAndroid Build Coastguard Worker
57*2e9d4914SAndroid Build Coastguard Worker    *)
58*2e9d4914SAndroid Build Coastguard Worker        echo "postinst called with unknown argument \`$1'" >&2
59*2e9d4914SAndroid Build Coastguard Worker        exit 1
60*2e9d4914SAndroid Build Coastguard Worker    ;;
61*2e9d4914SAndroid Build Coastguard Workeresac
62*2e9d4914SAndroid Build Coastguard Worker
63*2e9d4914SAndroid Build Coastguard Worker# dh_installdeb will replace this with shell code automatically
64*2e9d4914SAndroid Build Coastguard Worker# generated by other debhelper scripts.
65*2e9d4914SAndroid Build Coastguard Worker
66*2e9d4914SAndroid Build Coastguard Worker#DEBHELPER#
67*2e9d4914SAndroid Build Coastguard Worker
68*2e9d4914SAndroid Build Coastguard Workerexit 0
69