source: Slackware/i2p/i2p.SlackBuild @ e6bf1af9

Last change on this file since e6bf1af9 was e6bf1af9, checked in by sponge <sponge@…>, 10 years ago

Sanity and some fixs for slackware package

  • Property mode set to 100755
File size: 3.9 KB
Line 
1#!/bin/sh
2#
3# Heavily based on the Slackware 12.2 SlackBuild
4# Slackware build script for I2P
5#
6# PLEASE READ THIS:
7# Probably you will never have to update I2P packages with upgradepkg,
8# just because I2P has an auto-update function.
9# Really you should not ever use any "upgrade" method.
10#
11# The correct way to upgrade is to:
12# 1: install the upgrade
13# 2: remove the old package
14#
15# It is a terrible shame that upgradepkg doesn't do this, infact,
16# it would actually be the correct way for *any* package!
17#
18#
19
20BUILD=1sponge
21INSTALL_DIR=opt
22NAME=i2p
23ARCH=noarch
24
25# Less than slackware 13?
26SLKPLT=$(cat /etc/slackware-version | sed -re "s/(Slackware )([0-9]*)(.*)/\2/")
27if [ $SLKPLT -lt 13 ] ; then
28        EXT=tgz
29else
30        EXT=txz
31fi
32
33
34#
35# This mess is here due to the totally moronic way i2p does versioning.
36# We correct it here.
37#
38ROUTER=$(echo -ne "_")$(cat ../../router/java/src/net/i2p/router/RouterVersion.java | grep -e "public final static long BUILD" | cut -f2 -d"=" | cut -f1 -d";" | sed -re "s/ //g")
39if [ "$ROUTER" == "_" ] ;  then
40        ROUTER="_0"
41fi
42
43#
44# That was the easy one, now for the tough one.
45#
46
47CORE=$(cat ../../core/java/src/net/i2p/CoreVersion.java | grep -e "public final static String VERSION" | cut -f2 -d'"' | sed -re "s/ //g")
48CORE1=$(echo -n $CORE.x.x | sed -re "s/(.*)\.(.*)\.(.*)\.(.*)/\1/")
49CORE2=$(echo -n $CORE.x | sed -re "s/(.*)\.(.*)\.(.*)\.(.*)/\1/")
50
51if [ "$CORE.x.x" == "$CORE1" ] ; then
52        CORE=$(echo -ne $CORE".0.0")
53fi
54if [ "$CORE.x" == "$CORE2" ] ; then
55        CORE=$(echo -ne $CORE".0")
56fi
57
58VERSION=$(echo $CORE$ROUTER)
59#
60# Whew!
61# OK, let's build i2p
62#
63
64CWD=$(pwd)
65TMP=/tmp
66
67PKG=$TMP/package-i2p
68rm -rf $PKG
69mkdir -p $PKG
70
71cd $CWD/../../
72
73ant distclean
74#ant dist
75ant tarball
76
77tar xjvf i2p.tar.bz2 -C $TMP
78
79cd $TMP/i2p
80chown -R root:root .
81
82mkdir -p $PKG/$INSTALL_DIR/
83cp -a ../i2p $PKG/$INSTALL_DIR/
84
85mkdir -p $PKG/install
86
87#############################################################################
88# Preconfigureation to make package smaller, and...
89# we keep as much as reasonable in the installation directory.
90# This makes the install map fairly well to the standard installation.
91# It also makes it easier to find the log and pid files!
92#############################################################################
93cd $PKG/$INSTALL_DIR/i2p
94
95# wrapper.config $INSTALL_PATH and $SYSTEM_java_io_tmpdir
96sed "s|\$INSTALL_PATH|/$INSTALL_DIR/i2p|g" wrapper.config > a
97sed "s|\$SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" a > wrapper.config
98# eepget %INSTALL_PATH
99sed "s|\$INSTALL_PATH|/$INSTALL_DIR/i2p|g" eepget > a
100rm eepget
101mv a eepget
102# runplain.sh %INSTALL_PATH and %SYSTEM_java_io_tmpdir
103sed "s|%INSTALL_PATH|/$INSTALL_DIR/i2p|g" runplain.sh > a
104sed "s|%SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" a > runplain.sh
105# i2prouter %INSTALL_PATH and %SYSTEM_java_io_tmpdir
106sed "s|%INSTALL_PATH|/$INSTALL_DIR/i2p|g" i2prouter > a
107sed "s|%SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" a > i2prouter
108
109chmod 744 ./i2prouter
110chmod 744 ./osid
111chmod 744 ./runplain.sh
112chmod 744 ./eepget
113chmod 744 ./scripts/i2pbench.sh
114chmod 744 ./scripts/i2ptest.sh
115rm -Rf ./lib/*.dll ./*.bat ./*.exe ./installer ./icons ./a postinstall.sh
116
117mv $PKG/$INSTALL_DIR/i2p/*.config $PKG/install
118mv $PKG/$INSTALL_DIR/i2p/blocklist.txt $PKG/$INSTALL_DIR/i2p/blocklist.txt.new
119mv $PKG/$INSTALL_DIR/i2p/eepsite/jetty.xml $PKG/$INSTALL_DIR/i2p/eepsite/jetty.xml.new
120mv $PKG/$INSTALL_DIR/i2p/eepsite/docroot/index.html $PKG/$INSTALL_DIR/i2p/eepsite/docroot/index.html.new
121mv $PKG/$INSTALL_DIR/i2p/eepsite/docroot/favicon.ico $PKG/$INSTALL_DIR/i2p/eepsite/docroot/favicon.ico.new
122sed "s|directory|/$INSTALL_DIR/i2p/|g" $CWD/doinst.sh > $PKG/install/doinst.sh
123cat $CWD/slack-desc > $PKG/install/slack-desc
124
125cd $PKG
126#
127# requiredbuilder fucks up REALLY bad, and thinks java is perl?!
128# It also did not catch the shell requirements! BOOOOOOOOOOO! HISSSSSSSS!
129#
130# requiredbuilder -v -y -s $CWD $PKG
131#
132cat $CWD/slack-required > $PKG/install/slack-required
133makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.$EXT
Note: See TracBrowser for help on using the repository browser.