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
Line 
1#!/bin/sh
2
3# Abort on error or unset variables
4set -e
5set -u
6
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
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).
17        return
18    fi
19
20    # If this file doesn't exist yet, drop the .new extension.
21    if [ ! -r $OLD ]; then
22        mv $NEW $OLD
23        return
24    elif [ "$(md5sum $OLD | cut -d' ' -f1)" = "$(md5sum $NEW | cut -d' ' -f1)" ]; then
25        # If there are no differences in the files, remove the file with the .new extension.
26        rm $NEW
27        return
28    fi
29    # Alert the admin if they differ, but let's not be terribly obnoxious about it.
30    echo "WARNING: The files $OLD and $NEW differ." >&2
31}
32
33# Unlike previous versions of the package, we install i2prouter and eepget to /usr/bin
34# to make them available within the system PATH.
35
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)
41
42if $(uname -m | grep -q '64'); then
43    (cd $INST_DIR; ln -sf i2psvc-linux-x86-64 i2psvc)
44else
45    (cd $INST_DIR; ln -sf i2psvc-linux-x86-32 i2psvc)
46fi
47
48config /etc/rc.d/rc.i2p.new
49config $INST_DIR/wrapper.config.new
50
51if [ -e /var/log/packages/i2p-base* ]; then
52    echo "Warning: This package supersedes the 'i2p-base' package." >&2
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
58
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.