source: Slackware/i2p/doinst.sh @ 2fd0ed1

Last change on this file since 2fd0ed1 was 2fd0ed1, checked in by zzz <zzz@…>, 4 years ago

spelling

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[1f8f3eb]1#!/bin/sh
[c4870021]2
[1f8f3eb]3# Abort on error or unset variables
4set -e
5set -u
[c4870021]6
[1f8f3eb]7# This is changed by i2p.SlackBuild
8INST_DIR=directory
9PKGNAME="%pkg"
10
11config() {
12    NEW="$1"
13    OLD="$(dirname $NEW)/$(basename $NEW .new)"
14    if [ ! -r $NEW ]; then
[ff189e7]15        # If we get here there's a flaw in the packaging. We'll just return so that
16        # we don't emit a spurious error for the user. (It's not the user's problem).
[1f8f3eb]17        return
18    fi
19
[ff189e7]20    # If this file doesn't exist yet, drop the .new extension.
[1f8f3eb]21    if [ ! -r $OLD ]; then
22        mv $NEW $OLD
23        return
24    elif [ "$(md5sum $OLD | cut -d' ' -f1)" = "$(md5sum $NEW | cut -d' ' -f1)" ]; then
[ff189e7]25        # If there are no differences in the files, remove the file with the .new extension.
[1f8f3eb]26        rm $NEW
27        return
28    fi
[ff189e7]29    # Alert the admin if they differ, but let's not be terribly obnoxious about it.
[1f8f3eb]30    echo "WARNING: The files $OLD and $NEW differ." >&2
[c4870021]31}
32
[1f8f3eb]33# Unlike previous versions of the package, we install i2prouter and eepget to /usr/bin
34# to make them available within the system PATH.
[b6b1491]35
[1f8f3eb]36# Users might still want to /opt/i2p/i2prouter or /opt/i2p/eepget so we'll create symlinks
37# in the installation directory.
38ln -sf /usr/bin/eepget $INST_DIR
39ln -sf /usr/bin/i2prouter $INST_DIR
40(cd /usr/doc/$PKGNAME; ln -sf $INST_DIR/history.txt changelog)
[c4870021]41
[1f8f3eb]42if $(uname -m | grep -q '64'); then
43    (cd $INST_DIR; ln -sf i2psvc-linux-x86-64 i2psvc)
[e3de3dc]44else
[1f8f3eb]45    (cd $INST_DIR; ln -sf i2psvc-linux-x86-32 i2psvc)
[e3de3dc]46fi
[c4870021]47
[1f8f3eb]48config /etc/rc.d/rc.i2p.new
49config $INST_DIR/wrapper.config.new
50
51if [ -e /var/log/packages/i2p-base* ]; then
[2fd0ed1]52    echo "Warning: This package supersedes the 'i2p-base' package." >&2
[1f8f3eb]53    echo
54    echo "You may want to 'removepkg i2p-base'" >&2
55    echo "and check the contents of /etc/rc.d/rc.local*" >&2
56    echo "for correctness" >&2
57fi
[c4870021]58
[1f8f3eb]59# Remove extraneous 'sh' from sponge's set-up
60sed -i 's|sh /etc/rc\.d/rc\.i2p|/etc/rc.d/rc.i2p|g' /etc/rc.d/rc.local*
Note: See TracBrowser for help on using the repository browser.