|  | @@ -0,0 +1,89 @@
 | 
	
		
			
			|  | 1 | +#!/bin/bash
 | 
	
		
			
			|  | 2 | +#
 | 
	
		
			
			|  | 3 | +# .---.                  .              .
 | 
	
		
			
			|  | 4 | +# |                      |              |
 | 
	
		
			
			|  | 5 | +# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
 | 
	
		
			
			|  | 6 | +# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
 | 
	
		
			
			|  | 7 | +# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
 | 
	
		
			
			|  | 8 | +#
 | 
	
		
			
			|  | 9 | +#                    Freedom in the Cloud
 | 
	
		
			
			|  | 10 | +#
 | 
	
		
			
			|  | 11 | +# Recent version of guile
 | 
	
		
			
			|  | 12 | +#
 | 
	
		
			
			|  | 13 | +# License
 | 
	
		
			
			|  | 14 | +# =======
 | 
	
		
			
			|  | 15 | +#
 | 
	
		
			
			|  | 16 | +# Copyright (C) 2017 Bob Mottram <bob@freedombone.net>
 | 
	
		
			
			|  | 17 | +#
 | 
	
		
			
			|  | 18 | +# This program is free software: you can redistribute it and/or modify
 | 
	
		
			
			|  | 19 | +# it under the terms of the GNU Affero General Public License as published by
 | 
	
		
			
			|  | 20 | +# the Free Software Foundation, either version 3 of the License, or
 | 
	
		
			
			|  | 21 | +# (at your option) any later version.
 | 
	
		
			
			|  | 22 | +#
 | 
	
		
			
			|  | 23 | +# This program is distributed in the hope that it will be useful,
 | 
	
		
			
			|  | 24 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
	
		
			
			|  | 25 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
	
		
			
			|  | 26 | +# GNU Affero General Public License for more details.
 | 
	
		
			
			|  | 27 | +#
 | 
	
		
			
			|  | 28 | +# You should have received a copy of the GNU Affero General Public License
 | 
	
		
			
			|  | 29 | +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
	
		
			
			|  | 30 | +
 | 
	
		
			
			|  | 31 | +GUILE_VERSION='2.2.0'
 | 
	
		
			
			|  | 32 | +GUILE_HASH='c707b9cf6f97ecca3a4e3e704e62b83f95f1aec28ed1535f5d0a1d36af07a015'
 | 
	
		
			
			|  | 33 | +
 | 
	
		
			
			|  | 34 | +EIGHTSYNC_REPO="git://git.savannah.gnu.org/8sync.git"
 | 
	
		
			
			|  | 35 | +EIGHTSYNC_COMMIT=''
 | 
	
		
			
			|  | 36 | +
 | 
	
		
			
			|  | 37 | +function install_8sync {
 | 
	
		
			
			|  | 38 | +    apt-get -qy install flex libunistring-dev libgc-dev autoconf texinfo
 | 
	
		
			
			|  | 39 | +
 | 
	
		
			
			|  | 40 | +    if [ ! -d $INSTALL_DIR ]; then
 | 
	
		
			
			|  | 41 | +        mkdir $INSTALL_DIR
 | 
	
		
			
			|  | 42 | +    fi
 | 
	
		
			
			|  | 43 | +    cd $INSTALL_DIR
 | 
	
		
			
			|  | 44 | +
 | 
	
		
			
			|  | 45 | +    git_clone $EIGHTSYNC_REPO $INSTALL_DIR/eightsync
 | 
	
		
			
			|  | 46 | +    cd $INSTALL_DIR/eightsync
 | 
	
		
			
			|  | 47 | +    git checkout ${EIGHTSYNC_COMMIT} -b ${EIGHTSYNC_COMMIT}
 | 
	
		
			
			|  | 48 | +    GUILE_PATH=/opt/guile-${GUILE_VERSION}
 | 
	
		
			
			|  | 49 | +    PATH=${GUILE_PATH}/bin:$PATH
 | 
	
		
			
			|  | 50 | +    export GUILE_CFLAGS="-I${GUILE_PATH}/include"
 | 
	
		
			
			|  | 51 | +    export GUILE_LIBS="-L${GUILE_PATH}/lib"
 | 
	
		
			
			|  | 52 | +    ./bootstrap.sh
 | 
	
		
			
			|  | 53 | +    configure
 | 
	
		
			
			|  | 54 | +    make
 | 
	
		
			
			|  | 55 | +    make install
 | 
	
		
			
			|  | 56 | +}
 | 
	
		
			
			|  | 57 | +
 | 
	
		
			
			|  | 58 | +function install_guile {
 | 
	
		
			
			|  | 59 | +    # Currently this only works for x86_64
 | 
	
		
			
			|  | 60 | +    read_config_param ARCHITECTURE
 | 
	
		
			
			|  | 61 | +    if [[ ${ARCHITECTURE} != "x86_64" ]]; then
 | 
	
		
			
			|  | 62 | +        return
 | 
	
		
			
			|  | 63 | +    fi
 | 
	
		
			
			|  | 64 | +    GUILE_ARCH='x86_64'
 | 
	
		
			
			|  | 65 | +
 | 
	
		
			
			|  | 66 | +    apt-get -qy install flex libunistring-dev libgc-dev autoconf texinfo lzip wget
 | 
	
		
			
			|  | 67 | +
 | 
	
		
			
			|  | 68 | +    if [ ! -d $INSTALL_DIR ]; then
 | 
	
		
			
			|  | 69 | +        mkdir $INSTALL_DIR
 | 
	
		
			
			|  | 70 | +    fi
 | 
	
		
			
			|  | 71 | +    cd $INSTALL_DIR
 | 
	
		
			
			|  | 72 | +
 | 
	
		
			
			|  | 73 | +    if [ ! -f guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz ]; then
 | 
	
		
			
			|  | 74 | +        wget https://ftp.gnu.org/gnu/guile/guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz
 | 
	
		
			
			|  | 75 | +    fi
 | 
	
		
			
			|  | 76 | +    if [ ! -f guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz ]; then
 | 
	
		
			
			|  | 77 | +        echo 'Unable to download guile pack'
 | 
	
		
			
			|  | 78 | +        exit 6735238
 | 
	
		
			
			|  | 79 | +    fi
 | 
	
		
			
			|  | 80 | +    CURR_GUILE_HASH=$(sha256sum guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz | awk -F ' ' '{print $1}')
 | 
	
		
			
			|  | 81 | +    if [[ "$CURR_GUILE_HASH" != "$GUILE_HASH" ]]; then
 | 
	
		
			
			|  | 82 | +        echo 'Guile hash does not match'
 | 
	
		
			
			|  | 83 | +        exit 7237625
 | 
	
		
			
			|  | 84 | +    fi
 | 
	
		
			
			|  | 85 | +    cd /
 | 
	
		
			
			|  | 86 | +    tar xvf $INSTALL_DIR/guile-${GUILE_VERSION}-pack-${GUILE_ARCH}-linux-gnu.tar.lz
 | 
	
		
			
			|  | 87 | +}
 | 
	
		
			
			|  | 88 | +
 | 
	
		
			
			|  | 89 | +# NOTE: deliberately no exit 0
 |