From b298094174d3e06045c98bff441206a806896cfb Mon Sep 17 00:00:00 2001 From: EUcancER Date: Thu, 27 Dec 2012 19:05:55 +0100 Subject: fix new installer, tested with debian install --- boot/painload.sh | 12 +----------- retiolum/scripts/tinc_setup/new_install.sh | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 24 deletions(-) mode change 100644 => 120000 boot/painload.sh diff --git a/boot/painload.sh b/boot/painload.sh deleted file mode 100644 index 32919e7d..00000000 --- a/boot/painload.sh +++ /dev/null @@ -1,11 +0,0 @@ -if [ ! `id -u` -eq "0" ] -then - echo "not root, trying sudo" - exec sudo "$0" "$@" -fi - -mkdir -p /etc/tinc/retiolum/ -git clone git://github.com/miefda/retiolum.git /etc/tinc/retiolum/hosts -cd /etc/tinc/retiolum/hosts/.scripts - -echo "use the build script of your choice from /etc/tinc/retiolum/hosts/.scripts" diff --git a/boot/painload.sh b/boot/painload.sh new file mode 120000 index 00000000..1ee91d92 --- /dev/null +++ b/boot/painload.sh @@ -0,0 +1 @@ +../infest/bootstrap.sh \ No newline at end of file diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 1227912e..994e16fc 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -60,7 +60,6 @@ host2subnet() { NEEDDOTSINSUB=$(expr 3 - $(echo $SUBNET4 | sed 's/[0-9]*//g')) FULLSUBNET=$(echo $SUBNET4$(eval "printf '.0'%.0s {1..${#NEEDDOTSINSUB}}"s)) - result=$(($(($((1 << $1)) - 1)) << $((32 - $1)))) byte="" for i in {0..2}; do @@ -121,9 +120,9 @@ get_hostname() #os autodetection find_os() { - if grep -qe 'Linux' /etc/*release 2>/dev/null; then + if grep -qe 'Linux' /etc/*release 2>/dev/null || grep -qe 'Linux' /etc/issue ; then OS=1 - elif which getprop&>/dev/null; then + elif type getprop >/dev/null; then OS=2 elif grep -qe 'OpenWrt' /etc/*release 2>/dev/null; then OS=3 @@ -149,13 +148,13 @@ if [ $OS -eq 0 ]; then fi #check if everything is installed -if ! which awk&>/dev/null; then +if ! type awk >/dev/null; then echo "Please install awk" exit 1 fi -if ! which curl&>/dev/null; then - if ! which wget&>/dev/null; then +if ! type curl >/dev/null; then + if ! type wget >/dev/null; then echo "Please install curl or wget" exit 1 else @@ -243,17 +242,17 @@ if [ $OS -eq 2 ]; then exit 1 else TINCBIN=/data/data/org.poirsouille.tinc_gui/files/tincd - if [ $TINCDIR == 'auto' ]; then TINCDIR=/usr/local/etc/tinc ;fi - if [ $TEMPDIR == 'auto' ]; then TEMPDIR=/data/secure/data ;fi + if [ $TINCDIR = 'auto' ]; then TINCDIR=/usr/local/etc/tinc ;fi + if [ $TEMPDIR = 'auto' ]; then TEMPDIR=/data/secure/data ;fi fi else - if ! which tincd&>/dev/null; then + if ! type tincd >/dev/null; then echo "Please install tinc" exit 1 else TINCBIN=tincd - if [ $TINCDIR == 'auto' ]; then TINCDIR=/etc/tinc ;fi - if [ $TEMPDIR == 'auto' ]; then TEMPDIR=/tmp/tinc-install-fu ;fi + if [ $TINCDIR = 'auto' ]; then TINCDIR=/etc/tinc ;fi + if [ $TEMPDIR = 'auto' ]; then TEMPDIR=/tmp/tinc-install-fu ;fi fi fi @@ -338,7 +337,7 @@ EOF host2subnet $MASK4 #check if ip is installed -if which ip&>/dev/null; then +if type ip >/dev/null; then echo 'dirname="`dirname "$0"`"' > tinc-up echo '' >> tinc-up echo 'conf=$dirname/tinc.conf' >> tinc-up @@ -375,7 +374,7 @@ chmod +x tinc-up chown -R root:root . #generate keys with tinc -if which tincctl&>/dev/null; then +if type tincctl >/dev/null; then yes | tincctl -n $NETNAME generate-keys cat rsa_key.pub >> hosts/$HOSTN else -- cgit v1.2.3 From 40d9d06aeb49c900aec886b0249596817ac828e4 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Thu, 27 Dec 2012 22:46:05 +0100 Subject: fixed url --- retiolum/scripts/tinc_setup/new_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 1227912e..e83bcbc7 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -17,7 +17,7 @@ HOSTN=${HOSTN:-$SYSHOSTN} NETNAME=${NETNAME:-retiolum} MASK4=${MASK4:-16} MASK6=${MASK6:-16} -URL=${URL:-euer.krebsco.de/retiolum/hosts.tar.gz} +URL=${URL:-http://euer.krebsco.de/retiolum/hosts.tar.gz} IRCCHANNEL=${IRCCHANNEL:-"#krebsco"} IRCSERVER=${IRCSERVER:-"irc.freenode.net"} -- cgit v1.2.3 From a6f33dfc31f64a3f8db4e80587f1fad82dcbebbe Mon Sep 17 00:00:00 2001 From: EUcancER Date: Thu, 27 Dec 2012 23:03:20 +0100 Subject: fix problems in new installer --- retiolum/scripts/tinc_setup/new_install.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 994e16fc..1555858f 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -6,7 +6,7 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then exec sudo -E "$0" "$@" exit 23 # go to hell fi - +set -euf # SUBNET4=${SUBNET4:-10.243} SUBNET6=${SUBNET6:-42} @@ -17,7 +17,7 @@ HOSTN=${HOSTN:-$SYSHOSTN} NETNAME=${NETNAME:-retiolum} MASK4=${MASK4:-16} MASK6=${MASK6:-16} -URL=${URL:-euer.krebsco.de/retiolum/hosts.tar.gz} +URL=${URL:-http://euer.krebsco.de/retiolum/hosts.tar.gz} IRCCHANNEL=${IRCCHANNEL:-"#krebsco"} IRCSERVER=${IRCSERVER:-"irc.freenode.net"} @@ -49,7 +49,7 @@ Options: -t \$DIR Choose another Temporary directory, default is /tmp/tinc-install-fu -o \$HOST Choose another Hostname, default is your system hostname -n \$NET Choose another tincd netname,this also specifies the path to your tinc config, default is retiolum - -u \$URL specify another hostsfiles.tar.gz url, default is euer.krebsco.de/retiolum/hosts.tar.gz + -u \$URL specify another hostsfiles.tar.gz url, default is http://euer.krebsco.de/retiolum/hosts.tar.gz -l \$OS specify an OS, numeric parameter.0=Automatic 1=Linux 2=Android, disables automatic OS-finding, default is 0 -r \$ADDR give the node an reachable remote address, ipv4 or dns EOF @@ -266,7 +266,7 @@ fi #get tinc-hostfiles mkdir -p $TEMPDIR/hosts -$LOADER euer.krebsco.de/retiolum/hosts.tar.gz | tar zx -C $TEMPDIR/hosts/ +$LOADER $URL | tar zx -C $TEMPDIR/hosts/ #check for free ip #version 4 @@ -315,7 +315,7 @@ else mv $TEMPDIR/hosts ./ fi -rm -r $TEMPDIR +rm -r $TEMPDIR || echo "$TEMPDIR does not exist, skipping removal" echo "Subnet = $IP4" > hosts/$HOSTN echo "Subnet = $IP6" >> hosts/$HOSTN -- cgit v1.2.3 From 0080bb1059ad5402500c747d56c19a175604ddda Mon Sep 17 00:00:00 2001 From: Lassulus Date: Thu, 27 Dec 2012 23:08:20 +0100 Subject: fixed hostmask generation --- retiolum/scripts/tinc_setup/new_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 41a1f73a..3f904871 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -58,7 +58,7 @@ EOF #convert hostmask to subnetmask only version 4 host2subnet() { - NEEDDOTSINSUB=$(expr 3 - $(echo $SUBNET4 | sed 's/[0-9]*//g')) + NEEDDOTSINSUB=$(expr 3 - $( echo $SUBNET4 | tr -C -d . | wc -c)) FULLSUBNET=$(echo $SUBNET4$(eval "printf '.0'%.0s {1..${#NEEDDOTSINSUB}}"s)) result=$(($(($((1 << $1)) - 1)) << $((32 - $1)))) byte="" -- cgit v1.2.3 From 5293a12d29879a295f12e28f70104dbd91bf1621 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Thu, 27 Dec 2012 23:14:10 +0100 Subject: added SURL parameter for supernodes.tar.gz url --- retiolum/scripts/tinc_setup/new_install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index b24a28a0..f4678c41 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -18,6 +18,7 @@ NETNAME=${NETNAME:-retiolum} MASK4=${MASK4:-16} MASK6=${MASK6:-16} URL=${URL:-http://euer.krebsco.de/retiolum/hosts.tar.gz} +SURL=${SURL:-http://euer.krebsco.de/retiolum/supernodes.tar.gz} IRCCHANNEL=${IRCCHANNEL:-"#krebsco"} IRCSERVER=${IRCSERVER:-"irc.freenode.net"} @@ -310,7 +311,7 @@ cd $TINCDIR/$NETNAME if [ $OS -eq 3 ]; then mkdir hosts - $LOADER http://euer.krebsco.de/retiolum/supernodes.tar.gz | tar xz -C hosts/ + $LOADER $SURL | tar xz -C hosts/ else mv $TEMPDIR/hosts ./ fi -- cgit v1.2.3 From 72be0c40f7bf594887364bf3dcb7774f99849b24 Mon Sep 17 00:00:00 2001 From: Lassulus Date: Thu, 27 Dec 2012 23:26:50 +0100 Subject: fixed install bug --- retiolum/scripts/tinc_setup/new_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index f4678c41..ad1a04ac 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -121,7 +121,7 @@ get_hostname() #os autodetection find_os() { - if grep -qe 'Linux' /etc/*release 2>/dev/null || grep -qe 'Linux' /etc/issue ; then + if grep -qe 'Linux' /etc/*release 2>/dev/null || grep -qe 'Linux' /etc/issue 2>/dev/null; then OS=1 elif type getprop >/dev/null; then OS=2 @@ -367,7 +367,7 @@ else echo '' >> tinc-up echo "addr4=\$(sed -n \"s|^ *Subnet *= *\\($SUBNET4[.][^ ]*\\) *$|\\1|p\" \$host)" >> tinc-up echo 'ifconfig $INTERFACE $addr4' >> tinc-up - echo "route add -net $FULLSUBNET netmask $RETARDEDMASK dev $INTERFACE " >> tinc-up + echo "route add -net $FULLSUBNET netmask $RETARDEDMASK dev \$INTERFACE " >> tinc-up fi #fix permissions -- cgit v1.2.3 From c73b44e358627551dfb4835c5eb0620078e6e9fc Mon Sep 17 00:00:00 2001 From: EUcancER Date: Thu, 27 Dec 2012 23:46:27 +0100 Subject: tinc_installer: fix ip_finder, Random, others --- retiolum/scripts/tinc_setup/new_install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index b24a28a0..fadfa9f7 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -28,8 +28,8 @@ OS=${OS:-0} IP4=${IP4:-0} IP6=${IP6:-0} -RAND4=0 -RAND6=0 +RAND4=1 +RAND6=1 usage() { @@ -94,7 +94,7 @@ check_ip_valid6() #check if ip is taken function check_ip_taken() { - if grep -q -E "$1(#|/)" $TEMPDIR/hosts/* ;then + if grep -q -r -E "$1(#|/)" $TEMPDIR/hosts/ ;then return 1 else return 0 @@ -366,7 +366,7 @@ else echo '' >> tinc-up echo "addr4=\$(sed -n \"s|^ *Subnet *= *\\($SUBNET4[.][^ ]*\\) *$|\\1|p\" \$host)" >> tinc-up echo 'ifconfig $INTERFACE $addr4' >> tinc-up - echo "route add -net $FULLSUBNET netmask $RETARDEDMASK dev $INTERFACE " >> tinc-up + echo "route add -net $FULLSUBNET netmask $RETARDEDMASK dev \$INTERFACE " >> tinc-up fi #fix permissions -- cgit v1.2.3 From d1c0f2ea597d4f043d9c4e7134c7a8f6bcbe9260 Mon Sep 17 00:00:00 2001 From: EUcancER Date: Fri, 28 Dec 2012 00:29:49 +0100 Subject: retiolum/install: enable shell-expansion until further notice, fallback for OS --- retiolum/scripts/tinc_setup/new_install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 0a49c983..90de1511 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -6,7 +6,7 @@ if test "${nosudo-false}" != true -a `id -u` != 0; then exec sudo -E "$0" "$@" exit 23 # go to hell fi -set -euf +set -eu # SUBNET4=${SUBNET4:-10.243} SUBNET6=${SUBNET6:-42} @@ -127,6 +127,9 @@ find_os() OS=2 elif grep -qe 'OpenWrt' /etc/*release 2>/dev/null; then OS=3 + else + echo "Cannot determine your operating system, falling back to Linux" + OS=1 fi } -- cgit v1.2.3