This file is indexed.

postinst is in slapos-node-unofficial 1.3.18-1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
set -e


# Automatically added by dh_python2:
if which pycompile >/dev/null 2>&1; then
	pycompile -p slapos-node-unofficial 
fi

# End automatically added section


. /usr/share/debconf/confmodule

# First, create a temporary configuration file before letting ucf handles the
# changes between the existing file (if any) and the new version
TEMP_CONFIG_FILE=`mktemp --tmpdir=/tmp slapos-node-unofficial.XXXXXX.cfg`
chmod 0644 $TEMP_CONFIG_FILE

echo "# Never edit this file by hand as it has been automatically generated by
# debconf. You can change the settings at any time by running:
# ``dpkg-reconfigure -pmedium slapos-node-unofficial''" > $TEMP_CONFIG_FILE

cat < /usr/share/slapos-node-unofficial/slapos-node-unofficial.cfg \
    >> $TEMP_CONFIG_FILE

# Synchronize master_url, key_file and cert_file with slapos-client.cfg
SLAPOS_CLIENT_CONFIG_FILE=/etc/slapos/slapos-client.cfg
if [ ! -f $SLAPOS_CLIENT_CONFIG_FILE ]; then
    SLAPOS_CLIENT_CONFIG_FILE=
fi

db_get shared/slapos/master_url
MASTER_URL="$RET"
WITH_HTTPS=$(echo "$MASTER_URL" | grep -q "^https://" && echo true || echo false)

db_get slapos-node-unofficial/computer_id
COMPUTER_ID="$RET"

sed -e "s#^\s*master_url\s*=.*#master_url = $MASTER_URL#" \
    -e "s#^\s*computer_id\s*=.*#computer_id = $COMPUTER_ID#" \
    -i $TEMP_CONFIG_FILE $SLAPOS_CLIENT_CONFIG_FILE

# Handle HTTPS URLs by just commenting/uncommenting the relevant lines
if $WITH_HTTPS; then
    sed -i 's/^\s*#\+\s*\(key_file\|cert_file\|certificate_repository_path\)/\1/' \
	$TEMP_CONFIG_FILE $SLAPOS_CLIENT_CONFIG_FILE
else
    sed -i 's/^\s*[^#]*\s*\(key_file\|cert_file\|certificate_repository_path\)/#\1/' \
	$TEMP_CONFIG_FILE $SLAPOS_CLIENT_CONFIG_FILE
fi

db_get slapos-node-unofficial/software_root
SOFTWARE_ROOT="$RET"

db_get slapos-node-unofficial/partition_amount
PARTITION_AMOUNT="$RET"

db_get slapos-node-unofficial/ipv4_local_network
IPV4_LOCAL_NETWORK="$RET"

sed -e "s#^\s*software_root\s*=.*#software_root = $SOFTWARE_ROOT#" \
    -e "s#^\s*partition_amount\s*=.*#partition_amount = $PARTITION_AMOUNT#" \
    -e "s#^\s*ipv4_local_network\s*=.*#ipv4_local_network = $IPV4_LOCAL_NETWORK#" \
    -i $TEMP_CONFIG_FILE

ucf --three-way --debconf-ok $TEMP_CONFIG_FILE \
    /etc/slapos/slapos-node-unofficial.cfg

db_go

rm -f $TEMP_CONFIG_FILE

exit 0