Skip to content

Instantly share code, notes, and snippets.

@amatus
Last active June 13, 2017 19:33
Show Gist options
  • Save amatus/d1d24e7766e9dbe2ba56 to your computer and use it in GitHub Desktop.
Save amatus/d1d24e7766e9dbe2ba56 to your computer and use it in GitHub Desktop.
This script installs or updates an existing install of the latest gnunet sources on debian jessie
#!/bin/sh -ex
apt-get update
apt-get install -y make libltdl-dev libsqlite3-dev libunistring-dev libidn11-dev zlib1g-dev autoconf libtool libgnutls28-dev libgcrypt20-dev libcurl4-gnutls-dev git libextractor-dev texinfo automake
apt-get install -y -t jessie-backports autopoint
[ -e /opt/gnunet/bin/gnunet-arm ] && [ -e /tmp/gnunet-system-runtime ] && su -s /bin/bash -c "/opt/gnunet/bin/gnunet-arm -e" gnunet
rm -rf /opt/mhd /opt/gnunet
[ -d libmicrohttpd/.svn ] && rm -rf libmicrohttpd
[ -d libmicrohttpd ] || git clone git://gnunet.org/libmicrohttpd.git
cd libmicrohttpd
git fetch
git reset --hard origin/master
git clean -dfx
./bootstrap
./configure --prefix=/opt/mhd
make
make install
cd ..
[ -d gnunet/.svn ] && rm -rf gnunet
[ -d gnunet ] || git clone git://gnunet.org/gnunet.git
cd gnunet
git fetch
git reset --hard origin/master
git clean -dfx
./bootstrap
./configure --prefix=/opt/gnunet --with-microhttpd=/opt/mhd
make
make install
cd ..
adduser --system --home /var/lib/gnunet --disabled-login gnunet
cat > /var/lib/gnunet/.profile << EOF
export LD_LIBRARY_PATH=/opt/gnunet/lib:/opt/mhd/lib
export PATH=\$PATH:/opt/gnunet/bin
EOF
mkdir -p /var/lib/gnunet/.config
cat > /var/lib/gnunet/.config/gnunet.conf << EOF
[ats]
WAN_QUOTA_IN = 100 MiB
WAN_QUOTA_OUT = 100 MiB
[datastore]
QUOTA = 5 GB
[nat]
DISABLEV6 = YES
[transport]
PLUGINS = tcp udp http_server http_client https_server https_client
[transport-udp]
BROADCAST = NO
BROADCAST_RECEIVE = NO
[gns]
FORCESTART = NO
EOF
chown -R gnunet /var/lib/gnunet/.profile /var/lib/gnunet/.config
# TODO make a real init script
grep -q gnunet-arm /etc/rc.local || cat >> /etc/rc.local << EOF
su -s /bin/bash -c "/opt/gnunet/bin/gnunet-arm -s" gnunet > /dev/null 2>&1 &
EOF
su -s /bin/bash -c "/opt/gnunet/bin/gnunet-arm -s" gnunet > /dev/null 2>&1 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment