postinst.base 2.21 KB
Newer Older
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 75 76 77 78 79 80
#!/bin/sh


set -e


mkdir -p /etc/opt/slapos/ssl/partition_pki
mkdir -p /opt/slapos/log





##DEBHELPER#
#. /usr/share/debconf/confmodule
#
#
#
## If user don't want to, it will go throw normal setup
#if [ -f  /etc/opt/slapos/shell_conf ]; then
#    
#    rm -f /etc/opt/slapos/shell_conf
#    CONFIG_FILE=/etc/opt/slapos/slapos.cfg
#
#    if [ ! -f "$CONFIG_FILE" ]; then
#	NEW_CONFIG_FILE=$CONFIG_FILE
#    else
#	NEW_CONFIG_FILE=/etc/opt/slapos/slapos.cfg.dpkg-new
#    fi
#
#    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''" > $NEW_CONFIG_FILE
#
#    cat < /usr/share/doc/slapos-node/examples/slapos.cfg >> $NEW_CONFIG_FILE
#
#    db_get slapos-node/master_url
#    MASTER_URL="$RET"
#    WITH_HTTPS=$(echo "$MASTER_URL" | grep -q "^https://" && echo true || echo false)
#
#    db_get slapos-node/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 $NEW_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/' \
#	    $NEW_CONFIG_FILE
#
#    # Renamed files
#	test -f /etc/opt/slapos/ssl/slapos.crt && \
#            mv /etc/opt/slapos/ssl/slapos.crt /etc/opt/slapos/ssl/computer.crt
#	test -f /etc/opt/slapos/ssl/slapos.key && \
#            mv /etc/opt/slapos/ssl/slapos.key /etc/opt/slapos/ssl/computer.key
#    else
#	sed -i 's/^\s*[^#]*\s*\(key_file\|cert_file\|certificate_repository_path\)/#\1/' \
#	    $NEW_CONFIG_FILE
#    fi
#
#    db_get slapos-node/partition_amount
#    PARTITION_AMOUNT="$RET"
#
#    db_get slapos-node/ipv4_local_network
#    IPV4_LOCAL_NETWORK="$RET"
#
#    sed -e "s#^\s*partition_amount\s*=.*#partition_amount = $PARTITION_AMOUNT#" \
#	-e "s#^\s*ipv4_local_network\s*=.*#ipv4_local_network = $IPV4_LOCAL_NETWORK#" \
#	-i $NEW_CONFIG_FILE
#
#    if [ "$CONFIG_FILE" != "$NEW_CONFIG_FILE" ]; then
#	ucfr slapos-node $CONFIG_FILE
#	ucf --debconf-ok --three-way $NEW_CONFIG_FILE $CONFIG_FILE
#	rm -f $NEW_CONFIG_FILE
#    fi
#
#fi