-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provide installer scripts for NIM, RSYNC, NDJBDNS
- Loading branch information
jordan
committed
Feb 20, 2021
1 parent
ea83bdd
commit 4609f26
Showing
4 changed files
with
335 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#! /bin/sh | ||
# | ||
# Install/update ndjbdns | ||
# | ||
# | ||
# RaspiOS/Debian/Ubuntu extra packages for compiling: | ||
# | ||
# autoconf automake g++ gcc | ||
# | ||
|
||
self=`basename "$0"` | ||
prfx=`dirname "$0"` | ||
|
||
ndjbdns_src="https://github.com/pjps/ndjbdns.git" | ||
ndjbdns_trg="$prfx/ndjbdns" | ||
ndjbdns_etc="/usr/local/src/ndjbdns-hideaway" | ||
|
||
suffix=package-updated | ||
ndjbdns_tag=`date +%Y%m%d%H%M%S-$suffix` | ||
|
||
|
||
# Install or update DNJBDNS sources | ||
if [ -d "$ndjbdns_trg/.git" ] | ||
then | ||
(set -x; cd "$ndjbdns_trg" && git pull origin master) | ||
else | ||
(set -x; git clone --depth 1 "$ndjbdns_src" "$ndjbdns_trg") | ||
fi || { | ||
echo | ||
echo "*** $self: something went wrong, please install manually" | ||
echo | ||
exit 2 | ||
} | ||
|
||
|
||
# Check the locally provided time stamp of last update | ||
if (cd "$ndjbdns_trg" && git describe 2>/dev/null) | grep -q "$suffix\$" | ||
then | ||
echo | ||
echo "*** $self: recently updated, already" | ||
echo | ||
else | ||
( | ||
trap "set +x;echo;echo '*** Oops, unexpected exit!';echo;trap" 0 | ||
set -ex | ||
cd "$ndjbdns_trg" | ||
|
||
# create/update configure script | ||
touch README | ||
aclocal | ||
autoheader | ||
libtoolize --automake --copy | ||
autoconf | ||
automake --add-missing --copy | ||
|
||
# configure and compile | ||
./configure --sysconfdir="$ndjbdns_etc" | ||
make | ||
|
||
# install binaries | ||
make install-strip | ||
|
||
# clean up | ||
make distclean | ||
[ -s README ] || rm -f README | ||
|
||
# set update time stamp | ||
git tag -a -m '' "$ndjbdns_tag" | ||
trap 0 | ||
) | ||
fi | ||
|
||
# End |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
#! /bin/sh | ||
# | ||
# Install/update nim compiler | ||
# | ||
# RaspiOS/Debian/Ubuntu runtime packages: | ||
# | ||
# gcc (optional libssl1.1) | ||
# | ||
# RaspiOS/Debian/Ubuntu extra packages for compiling: | ||
# | ||
# (optional libssl-dev) | ||
# | ||
|
||
self=`basename "$0"` | ||
prfx=`dirname "$0"` | ||
branch=devel | ||
|
||
# see CPU case below: docs not needed on raspi | ||
build_docs=yes | ||
|
||
nim_src="https://github.com/nim-lang/Nim.git" | ||
cso_src="https://github.com/nim-lang/csources" | ||
nim_trg="$prfx/nim" | ||
|
||
suffix=package-updated | ||
nim_tag=`date +%Y%m%d%H%M%S-$suffix` | ||
arch=`dpkg --print-architecture` | ||
|
||
case $arch in | ||
armhf) | ||
# No docs on RaspiOS/RaspberriPi | ||
CPU="--cpu $arch" | ||
build_docs=no | ||
esac | ||
|
||
# Install or update NIM sources | ||
if [ -d "$nim_trg/.git" ] | ||
then | ||
(set -x; cd "$nim_trg" && git pull origin $branch) | ||
else | ||
(set -x; git clone --depth=1 --branch=$branch "$nim_src" "$nim_trg") | ||
fi || { | ||
echo | ||
echo "*** $self: something went wrong, please install manually" | ||
echo | ||
exit 2 | ||
} | ||
|
||
# Check the locally provided time stamp of last update | ||
if (cd "$nim_trg" && git describe 2>/dev/null) | grep -q "$suffix\$" | ||
then | ||
echo | ||
echo "*** $self: recently updated, already" | ||
echo | ||
else | ||
( | ||
trap "set +x;echo;echo '*** Oops, unexpected exit!';echo;trap" 0 | ||
set -ex | ||
cd "$nim_trg" | ||
|
||
# import C library (make it resilient against temporary hangups) | ||
for _ in 1 2 3 | ||
do | ||
[ ! -d csources ] || | ||
mv csources csources~ | ||
rm -rf csources~ | ||
|
||
if git clone --depth=1 "$cso_src" | ||
then | ||
break | ||
fi | ||
|
||
sleep 10 | ||
done | ||
(cd csources && sh build.sh $CPU) | ||
|
||
./bin/nim c koch | ||
./koch boot -d:release | ||
./koch nimble || true | ||
./bin/nim c -d:release -o:bin/nimgrep tools/nimgrep.nim || true | ||
|
||
# clean up, save space | ||
find . -type d -name nimcache -print | xargs -n1 rm -rf | ||
rm -rf csources csources~ | ||
|
||
# make binaries accessible | ||
chmod +x ./bin/nim* | ||
|
||
# build docs unless disabled | ||
if [ yes = "$build_docs" ] | ||
then | ||
set +e | ||
rm -rf web/upload/[1-9]* | ||
./koch docs | ||
p=`ls -d web/upload/[1-9]*` | ||
./bin/nim --skipProjCfg buildIndex -o:$p/theindex.html $p || true | ||
fi | ||
|
||
# Install shell script stubs | ||
( | ||
set +x | ||
NIM_BIN="`pwd`/bin" | ||
mkdir -p /usr/local/bin | ||
for name in nim nimble nim-gdb nimgrep | ||
do | ||
cmd="/usr/local/bin/$name" | ||
|
||
if [ -x "$cmd" ] | ||
then | ||
continue | ||
elif [ -f "$cmd" ] | ||
then | ||
rm -f "$cmd~" | ||
mv "$cmd" "$cmd~" | ||
fi | ||
|
||
echo "*** $self: installing $cmd" | ||
( | ||
echo '#! /bin/sh' | ||
echo | ||
echo 'self=`basename $0`' | ||
echo "bind=$NIM_BIN" | ||
echo | ||
echo 'PATH=$bind:$PATH' | ||
echo | ||
echo 'exec "$bind/$self" "$@"' | ||
) >> "$cmd" | ||
|
||
chmod +x "$cmd" | ||
done | ||
) | ||
|
||
# set update time stamp | ||
git tag -a -m '' "$nim_tag" | ||
trap 0 | ||
) | ||
fi | ||
|
||
# End |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#! /bin/sh | ||
# | ||
# Install/update rsync, RaspiOS version is pretty old | ||
# | ||
# | ||
# RaspiOS/Debian/Ubuntu runtime packages: | ||
# | ||
# acl attr liblz4-1 libnginx-mod-stream libssl1.1 libzstd1 libxxhash0 | ||
# | ||
# RaspiOS/Debian/Ubuntu extra packages for compiling: | ||
# | ||
# autoconf automake g++ gcc libacl1-dev libattr1-dev liblz4-dev libssl-dev | ||
# libtool libxxhash-dev libzstd-dev python3-cmarkgfm | ||
# | ||
|
||
self=`basename "$0"` | ||
prfx=`dirname "$0"` | ||
|
||
rsync_src="https://github.com/WayneD/rsync.git" | ||
rsync_trg="$prfx/rsync" | ||
|
||
suffix=package-updated | ||
rsync_tag=`date +%Y%m%d%H%M%S-$suffix` | ||
|
||
|
||
# Install or update DNJBDNS sources | ||
if [ -d "$rsync_trg/.git" ] | ||
then | ||
(set -x; cd "$rsync_trg" && git pull origin master) | ||
else | ||
(set -x; git clone --depth 1 "$rsync_src" "$rsync_trg") | ||
fi || { | ||
echo | ||
echo "*** $self: something went wrong, please install manually" | ||
echo | ||
exit 2 | ||
} | ||
|
||
|
||
# Check the locally provided time stamp of last update | ||
if (cd "$rsync_trg" && git describe 2>/dev/null) | grep -q "$suffix\$" | ||
then | ||
echo | ||
echo "*** $self: recently updated, already" | ||
echo | ||
else | ||
( | ||
trap "set +x;echo;echo '*** Oops, unexpected exit!';echo;trap" 0 | ||
set -ex | ||
cd "$rsync_trg" | ||
|
||
# configure and compile | ||
./configure --sysconfdir=/usr/local/rsync-hideaway | ||
|
||
# kludge | ||
grep -q ZSTD_STATIC_LINKING_ONLY config.h || | ||
echo "#define ZSTD_STATIC_LINKING_ONLY" >> config.h | ||
|
||
make | ||
make check | ||
|
||
# install binaries | ||
make install-strip | ||
|
||
# clean up | ||
make distclean | ||
rm -rfv /usr/local/rsync-hideaway | ||
|
||
# set update time stamp | ||
git tag -a -m '' "$rsync_tag" | ||
trap 0 | ||
) | ||
fi | ||
|
||
# End |