source: Slackware/i2p/i2p.SlackBuild @ 5190b2d

Last change on this file since 5190b2d was 5190b2d, checked in by sponge <sponge@…>, 11 years ago

Fixups to Slackware scripts

  • Property mode set to 100755
File size: 3.7 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
89#############################################################################
90cd $PKG/$INSTALL_DIR/i2p
91
92# wrapper.config $INSTALL_PATH and $SYSTEM_java_io_tmpdir
93sed "s|\$INSTALL_PATH|$INSTALL_DIR/i2p|g" wrapper.config > a
94sed "s|\$SYSTEM_java_io_tmpdir|/var/tmp|g" a > wrapper.config
95# eepget %INSTALL_PATH
96sed "s|\$INSTALL_PATH|$INSTALL_DIR/i2p|g" eepget > a
97rm eepget
98mv a eepget
99# runplain.sh %INSTALL_PATH and %SYSTEM_java_io_tmpdir
100sed "s|%INSTALL_PATH|$INSTALL_DIR/i2p|g" runplain.sh > a
101sed "s|%SYSTEM_java_io_tmpdir|/var/tmp|g" a > runplain.sh
102# i2prouter %INSTALL_PATH and %SYSTEM_java_io_tmpdir
103sed "s|%INSTALL_PATH|$INSTALL_DIR/i2p|g" i2prouter > a
104sed "s|%SYSTEM_java_io_tmpdir|/var/tmp|g" a > i2prouter
105
106chmod 744 ./i2prouter
107chmod 744 ./osid
108chmod 744 ./runplain.sh
109chmod 744 ./eepget
110chmod 744 ./scripts/i2pbench.sh
111chmod 744 ./scripts/i2ptest.sh
112rm -Rf ./lib/*.dll ./*.bat ./*.exe ./installer ./icons ./a postinstall.sh
113
114mv $PKG/$INSTALL_DIR/i2p/*.config $PKG/install
115mv $PKG/$INSTALL_DIR/i2p/blocklist.txt $PKG/$INSTALL_DIR/i2p/blocklist.txt.new
116mv $PKG/$INSTALL_DIR/i2p/eepsite/jetty.xml $PKG/$INSTALL_DIR/i2p/eepsite/jetty.xml.new
117mv $PKG/$INSTALL_DIR/i2p/eepsite/docroot/index.html $PKG/$INSTALL_DIR/i2p/eepsite/docroot/index.html.new
118mv $PKG/$INSTALL_DIR/i2p/eepsite/docroot/favicon.ico $PKG/$INSTALL_DIR/i2p/eepsite/docroot/favicon.ico.new
119sed "s|directory|/$INSTALL_DIR/i2p/|g" $CWD/doinst.sh > $PKG/install/doinst.sh
120cat $CWD/slack-desc > $PKG/install/slack-desc
121
122cd $PKG
123#
124# requiredbuilder fucks up REALLY bad, and thinks java is perl?!
125# It also did not catch the shell requirements! BOOOOOOOOOOO! HISSSSSSSS!
126#
127# requiredbuilder -v -y -s $CWD $PKG
128#
129cat $CWD/slack-required > $PKG/install/slack-required
130makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.$EXT
Note: See TracBrowser for help on using the repository browser.