From 1f8f3eb4d945a463089f27e70b904f73a23dbd17 Mon Sep 17 00:00:00 2001 From: kytv Date: Fri, 13 Jun 2014 22:44:42 +0000 Subject: [PATCH] Fix up the included SlackBuild (ticket #1310) --- Slackware/README | 46 +++-- Slackware/i2p-base/README | 10 -- Slackware/i2p-base/build.xml | 8 - Slackware/i2p-base/doinst.sh | 157 ----------------- Slackware/i2p-base/i2p-base.SlackBuild | 57 ------- Slackware/i2p-base/rc.i2p_def | 68 -------- Slackware/i2p-base/slack-desc | 19 --- Slackware/i2p-base/slack-required | 1 - Slackware/i2p/README | 105 ++++++++---- Slackware/i2p/build.xml | 4 +- Slackware/i2p/doinst.sh | 107 ++++++------ Slackware/i2p/i2p.SlackBuild | 224 +++++++++++++------------ Slackware/i2p/rc.i2p | 185 ++++++++++++++++++++ Slackware/i2p/slack-desc | 6 +- Slackware/i2p/slack-required | 6 +- build.xml | 4 +- tests/scripts/checkscripts.sh | 3 + tests/scripts/checkxml.sh | 1 - 18 files changed, 464 insertions(+), 547 deletions(-) delete mode 100644 Slackware/i2p-base/README delete mode 100644 Slackware/i2p-base/build.xml delete mode 100644 Slackware/i2p-base/doinst.sh delete mode 100644 Slackware/i2p-base/i2p-base.SlackBuild delete mode 100644 Slackware/i2p-base/rc.i2p_def delete mode 100644 Slackware/i2p-base/slack-desc delete mode 100644 Slackware/i2p-base/slack-required create mode 100644 Slackware/i2p/rc.i2p diff --git a/Slackware/README b/Slackware/README index 2c02b8e2e..a5ed37368 100644 --- a/Slackware/README +++ b/Slackware/README @@ -15,36 +15,56 @@ Monotone 1.0 Slackbuilds are available at http://slackbuilds.org/. Git --- -Git is also an option to retrieve the I2P source code. That said, Monotone is *the* -authoritative source. Known Git repositories with the I2P source include +Git is also an option to retrieve the I2P source code. That said, the I2P +Monotone servers are *the* authoritative source. + +Public Git repositories hosting the I2P source and managed by I2P project team members include - https://github.com/i2p/i2p.i2p - http://git.repo.i2p/w/i2p.i2p.git (mirrored from Github) - http://sourceforge.net/p/i2p/code/ + Tarball ------- The latest stable release is always available from the I2P homepage at https://geti2p.net/get/. -Building the SlackBuild -======================= -The following is needed to build the i2p and i2p-base packages: +This SlackBuild +=============== -bash >= 3.1.017 -jre >= 7u55 -jdk >= 7u55 -apache-ant >= 1.7.1 +Requirements +------------- + +The following are needed to build the i2p package: + +* jre >= 6 +* jdk >= 6 +* gettext +* apache-ant >= 1.7.1 + +If you don't care about bundling the translations, the gettext requirement can +be avoided by adding -Drequire.gettext=false to the ant lines in +i2p/i2p.SlackBuild + +A JRE >= v6 is the only requirement to run I2P. + +Building +-------- + +As the root user, run either $I2PSRC/Slackware/i2p/i2p.SlackBuild or `ant slackpkg` to create a package +in $I2PSRC/Slackware/i2p which can be installed using the Slackware packaging tools. See also ======== -i2p/readme.txt +Please also take a look at -AND - -i2p-base/readme.txt +* i2p/README +* eepget(1) +* i2prouter(1) +* http://i2p-projekt.i2p / https://geti2p.net for additional information and tips. diff --git a/Slackware/i2p-base/README b/Slackware/i2p-base/README deleted file mode 100644 index 6575387f7..000000000 --- a/Slackware/i2p-base/README +++ /dev/null @@ -1,10 +0,0 @@ -An rc file called rc.i2p has been placed into the /etc/rc.d directory. -If you want to change installation dir, change the variable INSTALL_DIR -on base-i2p.SlackBuild and rebuild the package. You also will need to do the -same for the i2p package. - -The install script will insert everything needed into /etc/rc.d/rc.local and -into /etc/rc.d/rc.local_shutdown automatically. - -If you want to start I2P at boot you have to chmod +x /etc/rc.d/rc.i2p - diff --git a/Slackware/i2p-base/build.xml b/Slackware/i2p-base/build.xml deleted file mode 100644 index f8def337e..000000000 --- a/Slackware/i2p-base/build.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/Slackware/i2p-base/doinst.sh b/Slackware/i2p-base/doinst.sh deleted file mode 100644 index cc2277f36..000000000 --- a/Slackware/i2p-base/doinst.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/sh -# -# -# Now in the future we only need to look for '#I2P' and '#/I2P' -# for modifications to rc.local and rc.local_shutdown. -# I was a moron for not doing it this way in the first place :-) -- Sponge -# -# - -touch /etc/rc.d/rc.local -touch /etc/rc.d/rc.local_shutdown - -echo -echo -n "Check 1: /etc/rc.d/rc.local " -I2PRCA=`grep -c /etc/rc.d/rc.local -e '/etc/rc.d/rc.i2p'` - -if [ $I2PRCA -eq 0 ] ; then - echo '#I2P' >> /etc/rc.d/rc.local - echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local - echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local - echo " sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local - echo "fi" >> /etc/rc.d/rc.local - echo '#/I2P' >> /etc/rc.d/rc.local - echo "modified." -else - echo -n "looks OK so far," - # Fix old installs, or where people have modified. - - echo -n " Check 1A: " - I2PRCC=`grep -c /etc/rc.d/rc.local -e 'i2p-\*\.tmp'` - - if [ $I2PRCC -eq 0 ] ; then - DATA=$(cat /etc/rc.d/rc.local | sed -re 's/if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/#I2P\n\( cd \/tmp ; rm -Rf i2p-*.tmp \)\nif \[ -x \/etc\/rc.d\/rc.i2p \] ; then/') - echo "${DATA}" > /etc/rc.d/rc.local - echo -n "additional modifications applied," - else - echo -n "looks OK so far," - fi - - echo -n " Check 1B: " - I2PRCE=`grep -c /etc/rc.d/rc.local -e 'i2p-\*\.tmp'` - if [ $I2PRCE -eq 0 ] ; then - DATATOP=$(cat /etc/rc.d/rc.local | sed -n '0,/i2p-\*\.tmp/p' | sed '$d' ) - DATABOT=$(cat /etc/rc.d/rc.local | sed -n '/i2p-\*\.tmp/,$p' | sed -n '/^fi/,$p' | sed "1d") - echo "${DATATOP}" > /etc/rc.d/rc.local - echo '#I2P' >> /etc/rc.d/rc.local - echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local - echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local - echo " sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local - echo "fi" >> /etc/rc.d/rc.local - echo '#/I2P' >> /etc/rc.d/rc.local - echo "${DATABOT}" >> /etc/rc.d/rc.local - - echo -n "additional modifications applied," - else - echo -n "looks ok so far," - fi - echo -n " Check 1C: " - I2PRCF=`grep -c /etc/rc.d/rc.local -e '#/I2P'` - if [ $I2PRCF -eq 0 ] ; then - DATATOP=$(cat /etc/rc.d/rc.local | sed -n '0,/^#I2P/p' | sed '$d' ) - DATABOT=$(cat /etc/rc.d/rc.local | sed -n '/^#I2P/,$p' | sed -n '/^fi/,$p' | sed "1d") - echo "${DATATOP}" > /etc/rc.d/rc.local - echo '#I2P' >> /etc/rc.d/rc.local - echo '( cd /tmp ; rm -Rf i2p-*.tmp )' >> /etc/rc.d/rc.local - echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local - echo " sh /etc/rc.d/rc.i2p start" >> /etc/rc.d/rc.local - echo "fi" >> /etc/rc.d/rc.local - echo '#/I2P' >> /etc/rc.d/rc.local - echo "${DATABOT}" >> /etc/rc.d/rc.local - - echo -n "additional modifications applied," - else - echo -n "looks ok so far," - fi - echo " Done." -fi - -echo -n "Check 2: /etc/rc.d/rc.local_shutdown " -I2PRCB=`grep -c /etc/rc.d/rc.local_shutdown -e '/etc/rc.d/rc.i2p'` -if [ $I2PRCB -eq 0 ] ; then - echo "#I2P" >> /etc/rc.d/rc.local_shutdown - echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown - echo " sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown - echo "fi" >> /etc/rc.d/rc.local_shutdown - echo "#/I2P" >> /etc/rc.d/rc.local_shutdown - echo "modified." -else - echo -n "looks OK so far," - # Fix old installs - - echo -n " Check 1A: " - I2PRCG=`grep -c /etc/rc.d/rc.local_shutdown -e '#I2P'` - if [ $I2PRCG -eq 0 ] ; then - DATATOP=$(cat /etc/rc.d/rc.local_shutdown | sed -n '0,/^if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/p' | sed '$d' ) - DATABOT=$(cat /etc/rc.d/rc.local_shutdown | sed -n '/^if \[ -x \/etc\/rc\.d\/rc\.i2p \] ; then/,$p' | sed -n '/^fi/,$p' | sed "1d") - echo "${DATATOP}" > /etc/rc.d/rc.local_shutdown - echo '#I2P' >> /etc/rc.d/rc.local_shutdown - echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown - echo " sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown - echo "fi" >> /etc/rc.d/rc.local_shutdown - echo "#/I2P" >> /etc/rc.d/rc.local_shutdown - echo "${DATABOT}" >> /etc/rc.d/rc.local_shutdown - echo -n "additional modifications applied," - else - echo -n "looks OK so far," - fi - echo -n " Check 1B: " - I2PRCH=`grep -c /etc/rc.d/rc.local_shutdown -e '#/I2P'` - if [ $I2PRCH -eq 0 ] ; then - DATATOP=$(cat /etc/rc.d/rc.local_shutdown | sed -n '0,/^#I2P/p' | sed '$d' ) - DATABOT=$(cat /etc/rc.d/rc.local_shutdown | sed -n '/^#I2P/,$p' | sed -n '/^fi/,$p' | sed "1d") - echo "${DATATOP}" > /etc/rc.d/rc.local_shutdown - echo '#I2P' >> /etc/rc.d/rc.local_shutdown - echo "if [ -x /etc/rc.d/rc.i2p ] ; then" >> /etc/rc.d/rc.local_shutdown - echo " sh /etc/rc.d/rc.i2p stop" >> /etc/rc.d/rc.local_shutdown - echo "fi" >> /etc/rc.d/rc.local_shutdown - echo "#/I2P" >> /etc/rc.d/rc.local_shutdown - echo "${DATABOT}" >> /etc/rc.d/rc.local_shutdown - echo -n "additional modifications applied," - else - echo -n "looks OK so far," - fi - echo " Done." -fi - -if [ -f /etc/rc.d/rc.i2p ] ; then - if [ -x /etc/rc.d/rc.i2p ] ; then - chmod +x /etc/rc.d/rc.i2p.new - fi - # Hopefully get admin's attention. - echo -ne "\007" ; sleep 0.3 - echo -ne "\007" ; sleep 0.3 - echo -ne "\007" ; sleep 0.3 - echo -ne "\007" ; sleep 0.3 - echo -ne "\007" ; sleep 0.3 - echo -ne "\007" ; sleep 0.3 - echo -e "\007" ; sleep 0.3 - echo "It apears that you already have /etc/rc.d/rc.i2p" - echo "You should replace it with /etc/rc.d/rc.i2p.new as soon as possible" - echo -ne "\007" ; sleep 0.3 - echo -ne "\007" ; sleep 0.3 - echo -ne "\007" ; sleep 0.3 - echo -ne "\007" ; sleep 0.3 - echo -ne "\007" ; sleep 0.3 - echo -ne "\007" ; sleep 0.3 - echo -e "\007" ; sleep 0.3 -else - mv /etc/rc.d/rc.i2p.new /etc/rc.d/rc.i2p - echo - echo "Installation finished. The i2p start/stop script has been" - echo "installed in /etc/rc.d . You should chmod +x" - echo '/etc/rc.d/rc.i2p to start it on boot.' - echo -fi - -exit diff --git a/Slackware/i2p-base/i2p-base.SlackBuild b/Slackware/i2p-base/i2p-base.SlackBuild deleted file mode 100644 index 5b44e63ef..000000000 --- a/Slackware/i2p-base/i2p-base.SlackBuild +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# -# Heavily based on the Slackware 12.2 SlackBuild -# Slackware build script for I2P -# -# PLEASE READ THIS: -# How to start I2P: -# After installpkg command, doinst.sh will execute a post-installation script -# needed by I2P. After that you have to chmod +x /etc/rc.d/rc.i2p and start -# I2P service with /etc/rc.d/rc.i2p start. -# -# Now tell your browser to user this proxy: localhost on port 4444 and open -# this page: http://localhost:7657/index.jsp -# -# Here you can configure I2P, watch network status and navigate anonimously. -# It's suggested to subscribe to various dns host, like i2host.i2p -# For any additional information, visit i2host.i2p and forum.i2p -# - -CWD=$(pwd) -TMP=/tmp -PKG=/$TMP/package-base-i2p -NAME=i2p-base -VERSION=0.0.4 -BUILD=1sponge -ARCH=noarch -INSTALL_DIR=opt - -# Less than slackware 13? -SLKPLT=$(cat /etc/slackware-version | sed -re "s/(Slackware )([0-9]*)(.*)/\2/") -if [ $SLKPLT -lt 13 ] ; then - EXT=tgz -else - EXT=txz -fi - -rm -rf $PKG -mkdir -p $PKG -cd $PKG -chown -R root:root . - -mkdir -p $PKG/etc/rc.d -mkdir -p $PKG/install -sed "s|directory|/$INSTALL_DIR/i2p/i2prouter|g" "$CWD/rc.i2p_def" > $PKG/etc/rc.d/rc.i2p.new -chmod 644 $PKG/etc/rc.d/rc.i2p.new -cat "$CWD/doinst.sh" > $PKG/install/doinst.sh -cat "$CWD/slack-desc" > $PKG/install/slack-desc - -cd $PKG -# -# Not really that important to exec this -# as there aren't any deps we don't know. -# -# requiredbuilder -v -y -s $CWD $PKG -# -cat "$CWD/slack-required" > $PKG/install/slack-required -makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.$EXT diff --git a/Slackware/i2p-base/rc.i2p_def b/Slackware/i2p-base/rc.i2p_def deleted file mode 100644 index ef96415ba..000000000 --- a/Slackware/i2p-base/rc.i2p_def +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# Start/stop i2p service. - -i2p_start() { - # Check if router is up first! - /bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory status )'" > /dev/null - if [ $? -eq 0 ] ; then { - # I2p is already running, so tell the user. - echo "I2P is already running..." - i2p_status - } - else - { - # Just in-case there are leftover junk in /tmp... - rm -Rf `grep /tmp/hsperfdata_root/* -le i2p` /tmp/i2p-*.tmp /tmp/router.ping - # Now that all junk is cleaned up, start. - /bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory start )'" - } - fi -} - -i2p_stop() { - /bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory stop )'" - rm -Rf `grep /tmp/hsperfdata_root/* -le i2p` /tmp/i2p-*.tmp /tmp/router.ping -} - -i2p_restart() { - # We want a FULL cycle here, not the wrappers idea of this! - i2p_stop - i2p_start -} - -i2p_status() { - /bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory status )'" -} - -i2p_console() { - /bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory console )'" -} - -i2p_dump() { - /bin/su - -c "/bin/bash -l -c '( export PATH=\"$PATH:/usr/lib/java/bin:/usr/lib/java/jre/bin\" ; directory dump )'" -} - -case "$1" in -'start') - i2p_start - ;; -'stop') - i2p_stop - ;; -'restart') - i2p_restart - ;; -'status') - i2p_status - ;; -'console') - i2p_console - ;; -'dump') - i2p_dump - ;; -*) - echo "usage $0 start|stop|restart|status|console|dump" - ;; -esac - diff --git a/Slackware/i2p-base/slack-desc b/Slackware/i2p-base/slack-desc deleted file mode 100644 index 4e94753a9..000000000 --- a/Slackware/i2p-base/slack-desc +++ /dev/null @@ -1,19 +0,0 @@ -# HOW TO EDIT THIS FILE: -# The "handy ruler" below makes it easier to edit a package description. Line -# up the first '|' above the ':' following the base package name, and the '|' on -# the right side marks the last column you can put a character in. You must make -# exactly 11 lines for the formatting to be correct. It's also customary to -# leave one space after the ':'. - - |-----handy-ruler------------------------------------------------------| -base-i2p: base-i2p (I2P anonymizing network base config files) -base-i2p: -base-i2p: I2P is an anonymizing network, offering a simple layer that -base-i2p: identity-sensitive applications can use to securely communicate. All -base-i2p: data is wrapped with several layers of encryption, and the network is -base-i2p: both distributed and dynamic, with no trusted parties. -base-i2p: Many applications are available that interface with I2P, including -base-i2p: mail, peer-peer file sharing, IRC chat, and others. -base-i2p: -base-i2p: This package provides the startup files. -base-i2p: diff --git a/Slackware/i2p-base/slack-required b/Slackware/i2p-base/slack-required deleted file mode 100644 index 7a7220e75..000000000 --- a/Slackware/i2p-base/slack-required +++ /dev/null @@ -1 +0,0 @@ -bash >= 3.1.017 diff --git a/Slackware/i2p/README b/Slackware/i2p/README index 82fbad206..9697b9259 100644 --- a/Slackware/i2p/README +++ b/Slackware/i2p/README @@ -1,46 +1,89 @@ -Building: -The i2p package will be installed to /opt/i2p +The I2P package will be installed to /opt/i2p. -If you want to change installation dir, change the variable INSTALL_DIR -in i2p.SlackBuild and rebuild the package. You will also need to do the same -in the base-i2p package. +To install to another location, set the variable INSTALL_DIR in i2p.SlackBuild +and rebuild the package. -Installation and Upgrade: -Probably you will never have to update i2p packages. However if you do, -be sure to installpkg first, then removepkg or custom config files can -be lost with upgradepkg. I2P has an auto-update function. However using -installpkg then removepkg lowers the demand on the I2P network as a -whole, and is by far faster. -After installpkg command, doinst.sh will execute a postinstallation script -needed by I2P. Be sure to also install the base-i2p package. +Installing and Upgrading: +========================= -Optional: +I2P has an auto-update function but generally speaking packages are managed by +packaging systems. Changing a package's files outside of the package system can +cause problems. To upgrade when there's a new I2P release, retrieve the new +source, re-run the SlackBuild, then use upgradepkg to update. -chmod +x /etc/rc.d/rc.i2p only if you want it to start on boot and stop on -shutdown. +To ignore all this and upgrade "in-network", simply change the permissions of the installation +directory (/opt/i2p by default). Something like the following would suffice: -How to start I2P: + chown -R USERNAME /opt/i2p -Start the I2P service with- -sh /etc/rc.d/rc.i2p start -Now tell your browser to use this proxy: 127.0.0.1 on port 4444 and open -this page: http://127.0.0.1:7657 -Here you can configure I2P, watch network status and navigate anonymously. -It's suggested to subscribe to various addressbook hosts so that you can -get to the many available eepsites and other service on I2P. These are not -set up by default for security reasons. +Starting and using I2P +====================== -Please see the faqs at http://i2p-projekt.i2p/faq or https://geti2p.net/faq for information about +Using the initscript +-------------------- + +To start I2P at boot, set the executable bit on /etc/rc.d/rc.i2p, add this +script to rc.local*, and set the variable "RUN_AS_USER" in /etc/rc.d/rc.i2p. + +Optionally, create a new user/group with limited rights to run I2P. + +Something like the following would work to start I2P at system boot, running under the +"i2p" account: + + echo '[ -x /etc/rc.d/rc.i2p ] && /etc/rc.d/rc.i2p start' >> /etc/rc.d/rc.local + echo '[ -x /etc/rc.d/rc.i2p ] && /etc/rc.d/rc.i2p stop' >> /etc/.rc.d/rc.local_shutdown + sed -i .bak 's/^.*\(RUN_AS_USER\)=.*/\1=i2p/' /etc/rc.d/rc.i2p + chmod 755 /etc/rc.d/rc.i2p + +Unless running as a user named "i2psvc", I2P's config directory defaults to +$HOME/.i2p. In the case of the "i2psvc" user, the default config directory is +/var/lib/i2p/i2p-config. + +It should not need to be said that using the "root" account is not recommended. + +When running using the initscript, I2P will write its logs to /var/log/i2p. + +Starting I2P "on-demand" +------------------------ + +As with a normal installation, I2P can be started with "i2prouter start". The +i2prouter and eepget scripts hve been installed to /usr/bin so they'll be +accessible in the default system PATH. + +When running using the i2prouter script, I2P will write its logs to $HOME/.i2p. + + +Configuring your browser +------------------------ + +In order to access eepSites (I2P-internal web sites) your web browser needs to +be configured. Set the HTTP Proxy to 127.0.0.1 and port 4444. For more information, see +https://geti2p.net/en/about/browser-config + +The I2P router console is reachable at http://127.0.0.1:7657. + + +Addressbook subscriptions +------------------------- + +Please see the FAQs at http://i2p-projekt.i2p/faq or https://geti2p.net/faq for information about the various addressbook services. -To stop I2P: - /etc/rc.d/rc.i2p stop + +Chatting on IRC +--------------- + +I2P comes preconfigured with a tunnel pointing to the I2P-only IRC network, +Irc2P. Signing on is easy, just connect to 127.0.0.1 on port 6668. Do not +configure a proxy in your IRC client. -For any additional information: +Additional information +====================== -Within I2P- http://i2p-projekt.i2p/, http://forum.i2p/, http://zzz.i2p +Within I2P: http://i2p-projekt.i2p/, http://forum.i2p/, http://zzz.i2p/, http://trac.i2p2.i2p/ +On the Internet: https://geti2p.net/, https://trac.i2p2.de +Manpages: i2prouter(1), eepget(1) -Internet (not reccomended!) - https://geti2p.net/ diff --git a/Slackware/i2p/build.xml b/Slackware/i2p/build.xml index 0683bdeb0..da31d49ae 100644 --- a/Slackware/i2p/build.xml +++ b/Slackware/i2p/build.xml @@ -2,7 +2,7 @@ - - + + diff --git a/Slackware/i2p/doinst.sh b/Slackware/i2p/doinst.sh index b6501dc4e..a59d069bc 100644 --- a/Slackware/i2p/doinst.sh +++ b/Slackware/i2p/doinst.sh @@ -1,72 +1,59 @@ -#!/bin/bash +#!/bin/sh +# Abort on error or unset variables +set -e +set -u + +# This is changed by i2p.SlackBuild INST_DIR=directory +PKGNAME="%pkg" -( cd install +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ ! -r $NEW ]; then + # Flaw in the packaging, this shouldn't happen. Just return. + return + fi -echo -for i in *.config ; { - if [ -f $INST_DIR/$i ] ; then - echo "Please check ${INST_DIR}${i}, as there is a new version." - cp $i $INST_DIR/$i.new - else - cp $i $INST_DIR/$i - fi + # If this file doesn't exist yet, drop the .new extension + if [ ! -r $OLD ]; then + mv $NEW $OLD + return + elif [ "$(md5sum $OLD | cut -d' ' -f1)" = "$(md5sum $NEW | cut -d' ' -f1)" ]; then + # If there are no differences in the files, remove the new one + rm $NEW + return + fi + # If they differ alert the admin (but let's not be terribly obnoxious about it) + echo "WARNING: The files $OLD and $NEW differ." >&2 } -) +# Unlike previous versions of the package, we install i2prouter and eepget to /usr/bin +# to make them available within the system PATH. -( cd $INST_DIR - if [ -f blocklist.txt ] ; then - echo "Please check ${INST_DIR}blocklist.txt, as there is a new version." - else - mv blocklist.txt.new blocklist.txt - fi -) +# Users might still want to /opt/i2p/i2prouter or /opt/i2p/eepget so we'll create symlinks +# in the installation directory. +ln -sf /usr/bin/eepget $INST_DIR +ln -sf /usr/bin/i2prouter $INST_DIR +(cd /usr/doc/$PKGNAME; ln -sf $INST_DIR/history.txt changelog) -( cd $INST_DIR/eepsite - if [ -f jetty.xml ] ; then - echo "Please check ${INST_DIR}/eepsite, as there are new files." - else - find $PKG/$INSTALL_DIR/i2p -name "*.xml.new" -exec sh -c 'mv "$0" "${0/.new}"' {} \; - fi -) - -( cd $INST_DIR/eepsite/docroot - if [ -f index.html ] ; then - rm index.html.new - else - mv index.html.new index.html - fi - if [ -f favicon.ico ] ; then - rm favicon.ico.new - else - mv favicon.ico.new favicon.ico - fi -) - -echo -echo "FINISHING I2P INSTALLATION. PLEASE WAIT." - -cd $INST_DIR - - - -OS_ARCH=`uname -m` -X86_64=`echo "$OS_ARCH" | grep x86_64` -if [ "X$X86_64" = "X" ]; then - wrapperpath="./lib/wrapper/linux" +if $(uname -m | grep -q '64'); then + (cd $INST_DIR; ln -sf i2psvc-linux-x86-64 i2psvc) else - wrapperpath="./lib/wrapper/linux64" + (cd $INST_DIR; ln -sf i2psvc-linux-x86-32 i2psvc) fi -cp $wrapperpath/libwrapper.so ./lib/ -cp $wrapperpath/wrapper.jar ./lib/ -cp $wrapperpath/i2psvc . -rm -rf ./lib/wrapper -chmod 755 ./i2psvc -echo -echo "Installation finished." -echo +config /etc/rc.d/rc.i2p.new +config $INST_DIR/wrapper.config.new -exit +if [ -e /var/log/packages/i2p-base* ]; then + echo "Warning: This package supercedes the 'i2p-base' package." >&2 + echo + echo "You may want to 'removepkg i2p-base'" >&2 + echo "and check the contents of /etc/rc.d/rc.local*" >&2 + echo "for correctness" >&2 +fi + +# Remove extraneous 'sh' from sponge's set-up +sed -i 's|sh /etc/rc\.d/rc\.i2p|/etc/rc.d/rc.i2p|g' /etc/rc.d/rc.local* diff --git a/Slackware/i2p/i2p.SlackBuild b/Slackware/i2p/i2p.SlackBuild index 325f19c84..52867b300 100755 --- a/Slackware/i2p/i2p.SlackBuild +++ b/Slackware/i2p/i2p.SlackBuild @@ -3,135 +3,139 @@ # Heavily based on the Slackware 12.2 SlackBuild # Slackware build script for I2P # -# PLEASE READ THIS: -# Probably you will never have to update I2P packages with upgradepkg, -# just because I2P has an auto-update function. -# Really you should not ever use any "upgrade" method. -# -# The correct way to upgrade is to: -# 1: install the upgrade -# 2: remove the old package -# -# It is a terrible shame that upgradepkg doesn't do this, infact, -# it would actually be the correct way for *any* package! +# Packages are generally prohibited from being updated outside +# of the package manager; this I2P SlackBuild is no different. # +# If you'd like to use the I2P "in-network" updates anyway, you'll need to +# grant the user that I2P will run as write permission to the installation directory +# (/opt/i2p by default). # +# For safety's sake, a user's I2P config files will *never* be overwritten by any upgrade method. +# In the future this SlackBuild may alert when a default config file is updated +## -BUILD=1sponge +# Make sure makepkg and friends can be found +PATH=$PATH:/sbin + +# abort on error and unset variables (same as set -e and set -u, respectively) +set -o errexit +set -o nounset + +if [ $(id -ur) -ne 0 ]; then + echo "ERROR: SlackBuilds require root access." >&2 + exit 1 +fi + +BUILD=1kytv # INSTALL_DIR is referenced from /, don't prefix it with a '/' INSTALL_DIR=opt NAME=i2p ARCH=noarch -# Less than slackware 13? -SLKPLT=$(cat /etc/slackware-version | sed -re "s/(Slackware )([0-9]*)(.*)/\2/") -if [ $SLKPLT -lt 13 ] ; then - EXT=tgz -else - EXT=txz -fi - - -# -# This mess is here due to the totally moronic way i2p does versioning. -# We correct it here. -# -ROUTER=$(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") -if [ "$ROUTER" == "_" ] ; then - ROUTER="_0" -fi - -# -# That was the easy one, now for the tough one. -# - -CORE=$(cat ../../core/java/src/net/i2p/CoreVersion.java | grep -e "public final static String VERSION" | cut -f2 -d'"' | sed -re "s/ //g") -CORE1=$(echo -n $CORE.x.x | sed -re "s/(.*)\.(.*)\.(.*)\.(.*)/\1/") -CORE2=$(echo -n $CORE.x | sed -re "s/(.*)\.(.*)\.(.*)\.(.*)/\1/") - -if [ "$CORE.x.x" == "$CORE1" ] ; then - CORE=$(echo -ne $CORE".0.0") -fi -if [ "$CORE.x" == "$CORE2" ] ; then - CORE=$(echo -ne $CORE".0") -fi - -VERSION=$(echo $CORE$ROUTER) -# -# Whew! -# OK, let's build i2p -# - -CWD=$(pwd) +CWD=$(readlink -m $(dirname $0)) +I2PSRC=$(readlink -m $CWD/../../) TMP=/tmp - PKG=$TMP/package-i2p -rm -rf $PKG -mkdir -p $PKG -cd $CWD/../../ +if [ -e "/etc/slackware-version" ]; then + # Older than Slackware 13? + SLACKVER=$(sed -e "s/Slackware\s\+\([0-9]\+\)\.\?\([0-9]\+\)\?/\1/" /etc/slackware-version) + if [ $SLACKVER -lt 13 ] ; then + EXT=tgz + else + EXT=txz + fi +else + echo "ERROR: This script is only intended for use on Slackware systems.">&2 + exit 1 +fi +# Extract version strings +I2PBUILD=$(sed -e '/^.\+long\s\+BUILD/!d' -e 's/^.\+long\s\+BUILD\s\+=\s\+\([0-9]\+\);/\1/' $I2PSRC/router/java/src/net/i2p/router/RouterVersion.java) +CORE=$(awk -F'"' '/static\s+String\s+VERSION/{print $2}' $I2PSRC/core/java/src/net/i2p/CoreVersion.java) +# Temporarily change the field separator to '.' so the version string can be split up +OLDIFS=$IFS +IFS="." +# split x.y.z into $1 $2 $3 +set -- $CORE +# Restore the field separator to the previous value +IFS=$OLDIFS +# With an I2P version string like x.y.z, $1 = x, $2 = y, $3 = z. +# $3 won't be reachable if the version is of the form x.y, so we'll temporarily set +u to prevent aborting if this variable isn't set +set +u +if [ -z $3 ]; then + # If CORE is a value like 0.9, we'll set CORE equal to 0.9.0 to match the old behaviour + CORE=${CORE}.0 +fi + +# From this point forward, unset variables are *unacceptable* +set -o nounset + +VERSION="${CORE}_${I2PBUILD}" + +[ -d $PKG ] && rm -rf $PKG +mkdir -p $PKG/$INSTALL_DIR $PKG/install + +cd "$I2PSRC" ant distclean -#ant dist -ant tarball +ant jbigi-linux-x86-only preppkg-unix -tar xjvf i2p.tar.bz2 -C $TMP +chown -R root:root $I2PSRC/pkg-temp +cp -a $I2PSRC/pkg-temp $PKG/$INSTALL_DIR/i2p -cd $TMP/i2p -chown -R root:root . - -mkdir -p $PKG/$INSTALL_DIR/ -cp -a ../i2p $PKG/$INSTALL_DIR/ - -mkdir -p $PKG/install - -############################################################################# -# Preconfigureation to make package smaller, and... -# we keep as much as reasonable in the installation directory. -# This makes the install map fairly well to the standard installation. -# It also makes it easier to find the log and pid files! -############################################################################# +# $INSTALL_DIR is used by this SlackBuild. +# [%$]INSTALL_PATH , [%$]SYSTEM_java_io_tmpdir, and [%$]USER_HOME have the correct paths set +# by the IzPack installer. cd $PKG/$INSTALL_DIR/i2p +for file in wrapper.config eepget i2prouter runplain.sh; do + sed -i "s|[%$]INSTALL_PATH|/$INSTALL_DIR/i2p|g;s|[$%]SYSTEM_java_io_tmpdir|$TMP|g;s/[%$]USER_HOME/\$HOME/g" $file +done +mv wrapper.config wrapper.config.new -# wrapper.config $INSTALL_PATH and $SYSTEM_java_io_tmpdir -sed "s|\$INSTALL_PATH|/$INSTALL_DIR/i2p|g" wrapper.config > a -sed "s|\$SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" a > wrapper.config -# eepget %INSTALL_PATH -sed "s|\$INSTALL_PATH|/$INSTALL_DIR/i2p|g" eepget > a -rm eepget -mv a eepget -# runplain.sh %INSTALL_PATH and %SYSTEM_java_io_tmpdir -sed "s|%INSTALL_PATH|/$INSTALL_DIR/i2p|g" runplain.sh > a -sed "s|%SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" a > runplain.sh -# i2prouter %INSTALL_PATH and %SYSTEM_java_io_tmpdir -sed "s|%INSTALL_PATH|/$INSTALL_DIR/i2p|g" i2prouter > a -rm i2prouter -mv a i2prouter -sed "s|%SYSTEM_java_io_tmpdir|/$INSTALL_DIR/i2p|g" i2prouter > a -sed "s|#ALLOW_ROOT=true|ALLOW_ROOT=true|g" a > i2prouter +install -d $PKG/usr/bin +install -d $PKG/usr/doc/$NAME-$VERSION +install -d $PKG/etc/rc.d +mv licenses LICENSE.txt -t $PKG/usr/doc/$NAME-$VERSION -chmod 744 ./i2prouter -chmod 744 ./osid -chmod 744 ./runplain.sh -chmod 744 ./eepget -chmod 744 ./scripts/i2pbench.sh -chmod 744 ./scripts/i2ptest.sh -rm -Rf ./lib/*.dll ./*.bat ./*.exe ./installer ./icons ./a postinstall.sh +# runplain will live in the installation directory. eepget and i2prouter will go to /usr/bin +# with symlinks in INST_DIR (created in doinst.sh) +install -m755 i2prouter $PKG/usr/bin +install -m755 eepget $PKG/usr/bin +chmod 755 ./runplain.sh -mv $PKG/$INSTALL_DIR/i2p/*.config $PKG/install -mv $PKG/$INSTALL_DIR/i2p/blocklist.txt $PKG/$INSTALL_DIR/i2p/blocklist.txt.new -find $PKG/$INSTALL_DIR/i2p -name "*.xml" -exec mv {} {}.new \; -mv $PKG/$INSTALL_DIR/i2p/eepsite/docroot/index.html $PKG/$INSTALL_DIR/i2p/eepsite/docroot/index.html.new -mv $PKG/$INSTALL_DIR/i2p/eepsite/docroot/favicon.ico $PKG/$INSTALL_DIR/i2p/eepsite/docroot/favicon.ico.new -sed "s|directory|/$INSTALL_DIR/i2p/|g" $CWD/doinst.sh > $PKG/install/doinst.sh -cat $CWD/slack-desc > $PKG/install/slack-desc +if [ $INSTALL_DIR != 'opt' ]; then + sed "s|\(The I2P package\)\s\+will be\s\+\(installed to\).+|\1 has been \2 $INSTALL_DIR/i2p|g" $CWD/README > $PKG/usr/doc/$NAME-$VERSION/README +else + sed "s|will be installed|has been installed|" $CWD/README > $PKG/usr/doc/$NAME-$VERSION/README +fi + +install -d $PKG/usr/man/man1 +gzip -9 man/*.1 +install -m644 man/*.1.gz $PKG/usr/man/man1 +rm -rf ./man + +# We install all x86 wrapper binaries. +# The i2prouter script will try to determine the OS (linux), the bits (32 VS 64) and should be able +# to figure out the correct wrapper binary to use. + +# Howver: In case the i2prouter script's detection fails, "$INST_DIR/i2psvc" will point to +# what 'we' think the correct binary is. +# +# A good reason for installing all binaries: in case the user, for whatever reason, switches from an +# x64 JRE to an x86 JRE, I2P should continue to work without needing to be reinstalled. +install -m755 $I2PSRC/installer/lib/wrapper/linux/i2psvc ./i2psvc-linux-x86-32 +install -m644 $I2PSRC/installer/lib/wrapper/linux/libwrapper.so ./lib/libwrapper-linux-x86-32.so +install -m755 $I2PSRC/installer/lib/wrapper/linux64/i2psvc ./i2psvc-linux-x86-64 +install -m644 $I2PSRC/installer/lib/wrapper/linux64/libwrapper.so ./lib/libwrapper-linux-x86-64.so +install -m644 $I2PSRC/installer/lib/wrapper/all/wrapper.jar ./lib/wrapper.jar +install -m644 $I2PSRC/build/jbigi.jar $PKG/$INSTALL_DIR/i2p/lib/jbigi.jar + +rm -f ./postinstall.sh ./osid ./INSTALL-*.txt +sed "s|directory|/$INSTALL_DIR/i2p|" $CWD/doinst.sh > $PKG/install/doinst.sh +sed -i "s|%pkg|$NAME-$VERSION|" $PKG/install/doinst.sh +sed "s|%INST_DIR|/$INSTALL_DIR/i2p|" $CWD/rc.i2p> $PKG/etc/rc.d/rc.i2p.new +cp $CWD/slack-desc $PKG/install/slack-desc cd $PKG -# -# requiredbuilder messes up REALLY bad, and thinks java is perl?! -# It also did not catch the shell requirements! BOOOOOOOOOOO! HISSSSSSSS! -# -# requiredbuilder -v -y -s $CWD $PKG -# -cat $CWD/slack-required > $PKG/install/slack-required +cp $CWD/slack-required $PKG/install/slack-required makepkg -l y -c n $CWD/${NAME}-$VERSION-$ARCH-$BUILD.$EXT diff --git a/Slackware/i2p/rc.i2p b/Slackware/i2p/rc.i2p new file mode 100644 index 000000000..ccbe073b9 --- /dev/null +++ b/Slackware/i2p/rc.i2p @@ -0,0 +1,185 @@ +#!/bin/sh + +# Abort on errors +set -e + +## +# This *must* be configured. Set this to the user that will run I2P. +# Note: If you don't want I2P to start automatically at boot, +# use "i2prouter start" as a non-root user to start I2P. +#RUN_AS_USER= +## + +## +# Set the locale as desired. +# Note: this is not the same as the language shown in the I2P router console. +# This affects the locale used in wrapper.log. For best results, use a +# unicode enabled locale (especially important for foreign language torrents). +# +# If not set the user's configured locale will be used. +#RCLOCALE= +## + +##################################################### +# Nothing below this point should need to be edited # +##################################################### +# %INST_DIR is set by i2p.SlackBuild +INSTALL_DIR="%INST_DIR" +# Make sure the package is installed and that the wrapper can be found +[ -d $INSTALL_DIR ] && [ -x $INSTALL_DIR/i2psvc ] || (echo "The I2P package is not installed" >&2 ; exit 1) + +if [ -z $RUN_AS_USER ]; then + echo "ERROR: RUN_AS_USER not configured in $0" >&2 + exit 1 +fi + +if [ $(id -ur) -ne 0 ]; then + echo 'ERROR: You must be root to start this service.' >&2 + echo + exit 1 +fi + +if [ -z $RCLOCALE ]; then + if [ ! $(locale -a |grep -q "en_US\.utf8") ]; then + RCLOCALE="en_US.utf8" + fi +fi + +# abort script if any variables are unset +set -u + +if $(uname -m |grep -q '64'); then + BITS='64' +else + BITS='' +fi + +PATH="$PATH:/usr/lib$BITS/java/bin:/usr/lib$BITS/java/jre/bin" +RUN=/var/run/i2p +PIDFILE="$RUN/i2p.pid" +WRAPPER_CONF="$INSTALL_DIR/wrapper.config" +WRAPPERLOG=/var/log/i2p/wrapper.log +I2PTEMP="/tmp/i2p-daemon" +DESC="The I2P daemon" +JAVABINARY=$(awk -F'=' '/^ *wrapper\.java\.command/{print $2}' "$WRAPPER_CONF") + +if [ ! $(which $JAVABINARY 2>/dev/null) ]; then + for rc in /etc/profile.d/*jdk*.sh /etc/profile.d/*java*.sh; do + [ -r $rc ] && . $rc + done + if [ ! $(which $JAVABINARY 2>/dev/null) ]; then + echo "ERROR: Cannot find java. Please set the path to java in $WRAPPER_CONF" >&2 + exit 1 + fi +fi + +JAVA=$(which $JAVABINARY 2>/dev/null) + +I2P_ARGS="$WRAPPER_CONF \ + wrapper.java.additional.1=-DloggerFilenameOverride=/var/log/i2p/log-router-@.txt \ + wrapper.java.additional.10=-Dwrapper.logfile=$WRAPPERLOG \ + wrapper.java.additional.11=-Di2p.dir.pid=$RUN \ + wrapper.java.additional.12=-Di2p.dir.temp=$I2PTEMP \ + wrapper.java.command=$JAVA \ + wrapper.logfile=$WRAPPERLOG \ + wrapper.pidfile=$PIDFILE \ + wrapper.daemonize=TRUE" + +LC_ALL=$RCLOCALE +LANG=$RCLOCALE +export LC_ALL LANG + +is_running() { + if [ -r $PIDFILE ]; then + PID="$(cat ${PIDFILE})" 2>/dev/null 2>&1 + if ! kill -0 $PID >/dev/null 2>&1; then + rm "$PIDFILE" + return 1 + else + return 0 + fi + else + return 1 + fi +} + +start() { + if is_running; then + echo "ERROR: $DESC is already running." >&2 + fi + + for DIR in $RUN $I2PTEMP; do + test -d $DIR && rm -rf $DIR + mkdir -p $DIR + chown -R $RUN_AS_USER $DIR + done + [ -d /var/log/i2p ] || mkdir /var/log/i2p + chown -R $RUN_AS_USER /var/log/i2p + + echo -n "Starting $DESC..." + TZ=UTC su $RUN_AS_USER -c "$INSTALL_DIR/i2psvc $I2P_ARGS" + is_running + echo "[pid: $PID]" +} + +stop(){ + if is_running; then + echo -n "Stopping $DESC [pid: $PID] (this could take a while)." + kill "$PID" >/dev/null 2>&1 + while kill -0 "$PID" > /dev/null 2>&1; do + echo -n . + sleep 1 + done + rm -rf "$RUN" "$I2PTEMP" + echo done. + return 0 + else + echo "$DESC is not running." >&2 + return 1 + fi +} + + +# Unset +u to allow the 'usage' text to be displayed +set +u +case "$1" in + start) + start + ;; + status) + if is_running; then + echo "$DESC is running [pid: $PID]" >&2 + else + echo "$DESC is not running." >&2 + fi + ;; + stop) + stop + ;; + graceful) + if is_running; then + kill -HUP $PID + echo "Graceful shutdown of $DESC initiated." >&2 + echo "This may take up to 11 minutes." >&2 + fi + ;; + dump) + if is_running; then + kill -3 $PID + echo "Threads dumped to $WRAPPERLOG" >&2 + else + echo "$DESC is not running." >&2 + fi + ;; + restart) + if is_running; then + stop + start + else + echo "$DESC is not running." >&2 + fi + ;; + *) + echo "usage: $0 start|stop|status|restart|graceful|dump" + ;; +esac diff --git a/Slackware/i2p/slack-desc b/Slackware/i2p/slack-desc index 281e5e894..317cfa571 100644 --- a/Slackware/i2p/slack-desc +++ b/Slackware/i2p/slack-desc @@ -6,7 +6,7 @@ # leave one space after the ':'. |-----handy-ruler----------------------------------------------------------| -i2p: i2p (an anonymizing network) +i2p: I2P (an anonymizing network) i2p: i2p: I2P is an anonymizing network, offering a simple layer that i2p: identity-sensitive applications can use to securely communicate. All @@ -14,6 +14,6 @@ i2p: data is wrapped with several layers of encryption, and the network is i2p: both distributed and dynamic, with no trusted parties. i2p: Many applications are available that interface with I2P, including i2p: mail, peer-peer file sharing, IRC chat, and others. -i2p: WARNING: To upgrade installpkg FIRST _THEN_ removepkg. -i2p: For more information, see: http://www.i2p2.de/ +i2p: +i2p: For more information, see: https://geti2p.net/ i2p: diff --git a/Slackware/i2p/slack-required b/Slackware/i2p/slack-required index d83d818e6..c7fd53aa1 100644 --- a/Slackware/i2p/slack-required +++ b/Slackware/i2p/slack-required @@ -1,4 +1,2 @@ -jre >= 5 -i2p-base >= 0.0.1 -bash >= 3.1.017 - +jre >= 6 +gettext diff --git a/build.xml b/build.xml index 161c56ace..321554987 100644 --- a/build.xml +++ b/build.xml @@ -42,7 +42,7 @@ - + @@ -1437,9 +1437,7 @@ - - diff --git a/tests/scripts/checkscripts.sh b/tests/scripts/checkscripts.sh index 8825fd471..28ee5f3c6 100755 --- a/tests/scripts/checkscripts.sh +++ b/tests/scripts/checkscripts.sh @@ -43,6 +43,9 @@ SCRIPTFILES="\ ./installer/resources/runplain.sh \ ./installer/resources/uninstall_i2p_service_osx.command ./installer/resources/uninstall_i2p_service_unix \ + ./Slackware/i2p/i2p.SlackBuild \ + ./Slackware/i2p/doinst.sh \ + ./Slackware/i2p/rc.i2p \ ./tests/scripts/checkcerts.sh \ ./tests/scripts/checkpo.sh \ ./tests/scripts/checkutf8.sh \ diff --git a/tests/scripts/checkxml.sh b/tests/scripts/checkxml.sh index 21a6b38de..4e6623c92 100755 --- a/tests/scripts/checkxml.sh +++ b/tests/scripts/checkxml.sh @@ -57,7 +57,6 @@ XMLFILES="\ ./installer/resources/eepsite/jetty.xml ./installer/resources/shortcutSpec.xml \ ./router/java/build.xml \ -./Slackware/i2p-base/build.xml \ ./Slackware/i2p/build.xml" HTMLFILES="\