wok annotate get-bitcoin/stuff/get-bitcoin @ rev 23034

updated libgdiplus and libggdiplus-dev again (2.10 -> 6.0.4)
author Hans-G?nter Theisgen
date Wed Mar 04 07:26:30 2020 +0100 (2020-03-04)
parents 0467021a4935
children
rev   line source
Hans-G?nter@22807 1 #!/bin/sh
Hans-G?nter@22807 2 #
Hans-G?nter@22807 3 # get-bitcoin - create and install SliTaz package bitcoin
Hans-G?nter@22807 4 #
Hans-G?nter@22807 5 # (C) 2020 SliTaz - GNU General Public License v3.
Hans-G?nter@22807 6 # Author : unknown
Hans-G?nter@22835 7 # modified by HGT on 2020-02-10
Hans-G?nter@22807 8 #
pascal@13744 9
Hans-G?nter@22807 10 # === Initialisations ===
Hans-G?nter@22807 11
Hans-G?nter@22807 12 PKGS_DB="/var/lib/tazpkg" # packages database directory
Hans-G?nter@22807 13 PACKAGE="bitcoin"
pascal@13744 14 CATEGORY="misc"
pascal@13744 15 SHORT_DESC="New digital currency for instant payments to anyone, anywhere."
pascal@14504 16 MAINTAINER="somebody@$PACKAGE.org"
Hans-G?nter@22807 17 WEB_SITE="https://bitcoin.org/"
pascal@13747 18 DEPENDS="libQtGui bzlib"
pascal@13744 19
Hans-G?nter@22807 20 # Declare functions check_root, status, ...
Hans-G?nter@22807 21 . /lib/libtaz.sh
Hans-G?nter@22807 22 # and make commandline options (if any) available as variables
pascal@13744 23
Hans-G?nter@22807 24 is_installed()
Hans-G?nter@22807 25 {
Hans-G?nter@22807 26 if [ -d $ROOT$PKGS_DB/installed/$PACKAGE ]
Hans-G?nter@22807 27 then #package is deemed to be installed
Hans-G?nter@22807 28 return 0
Hans-G?nter@22807 29 else
Hans-G?nter@22807 30 return 1
Hans-G?nter@22807 31 fi
Hans-G?nter@22807 32 }
Hans-G?nter@22807 33
Hans-G?nter@22807 34 # Show commandline options, if requested by --help
Hans-G?nter@22807 35 if [ "$help" == "yes" ]
Hans-G?nter@22807 36 then
Hans-G?nter@22807 37 echo "Commandline options:
Hans-G?nter@22807 38 $0
Hans-G?nter@22807 39 --version=<version>
Hans-G?nter@22807 40 --root=<path-to-root>
Hans-G?nter@22807 41 --install=yes|no
Hans-G?nter@22807 42 --keep=no|yes
Hans-G?nter@22807 43 --tmpdir=<directory-to-build-package>"
Hans-G?nter@22807 44 exit
pascal@13744 45 fi
pascal@13744 46
Hans-G?nter@22807 47 # Check for system administrator privileges
Hans-G?nter@22807 48 check_root
Hans-G?nter@22807 49
Hans-G?nter@22807 50 title "Package $PACKAGE will be build as SliTaz package and installed"
Hans-G?nter@22807 51
Hans-G?nter@22807 52 # Fetch latest version, unless version is set by option --version
Hans-G?nter@22807 53 [ -z "$version" ] && version="latest"
Hans-G?nter@22807 54
Hans-G?nter@22807 55 # Install SliTaz package, unless inhibited by option --install=no
Hans-G?nter@22807 56 [ -z "$install" ] && install="yes"
Hans-G?nter@22807 57
Hans-G?nter@22807 58 # Delete SliTaz package file $PACKAGE-$VERSION.tazpkg after installation,
Hans-G?nter@22807 59 # unless option --keep=yes is given
Hans-G?nter@22807 60 [ -z "$keep" ] && keep="no"
Hans-G?nter@22807 61
Hans-G?nter@22807 62 # Directory for temporary files
Hans-G?nter@22835 63 TMP_DIR="$tmpdir"
Hans-G?nter@22835 64 [ -z "$tmpdir" ] && TMP_DIR="/tmp/get-$PACKAGE"
Hans-G?nter@22807 65
Hans-G?nter@22807 66 # Logging file (unused by now)
Hans-G?nter@22807 67 LOG=$TMP_DIR/get-$PACKAGE.log
Hans-G?nter@22807 68
Hans-G?nter@22807 69 cat <<EOT
Hans-G?nter@22807 70 Options in use:
Hans-G?nter@22807 71 root : $root/
Hans-G?nter@22807 72 version : $version
Hans-G?nter@22807 73 install package: $install
Hans-G?nter@22807 74 keep tazpkg : $keep
Hans-G?nter@22807 75 build directory: $TMP_DIR
Hans-G?nter@22807 76
Hans-G?nter@22807 77 EOT
Hans-G?nter@22807 78
Hans-G?nter@22807 79 separator; newline
Hans-G?nter@22807 80
Hans-G?nter@22807 81 # === Remove package, if installed ===
Hans-G?nter@22835 82 if is_installed
Hans-G?nter@22807 83 then
Hans-G?nter@22807 84 action "Removing installed version..."
Hans-G?nter@22807 85 tazpkg remove $PACKAGE --root="$root/"
Hans-G?nter@22807 86 [ ! is_installed ] &&
Hans-G?nter@22807 87 die "Can't remove installed version. Exiting."
pascal@13744 88 fi
pascal@13744 89
Hans-G?nter@22807 90 # === Fetch archive file, if not existing ===
Hans-G?nter@22807 91 if [ "$version" == "latest" ]
Hans-G?nter@22807 92 then
Hans-G?nter@22807 93 WGET_URL=$(wget -q --no-check-certificate -O - ${WEB_SITE}en/download | \
Hans-G?nter@22807 94 sed '/linux-gnu.tar/!d; /i686/!d; s/.*href="\([^"]*\).*/\1/; s|/download$||')
Hans-G?nter@22807 95 WGET_URL=${WEB_SITE}$WGET_URL
Hans-G?nter@22807 96 FILE="$(basename $WGET_URL)"
Hans-G?nter@22807 97 VERSION="$(echo $FILE | sed 's|.*coin-\(.*\)-i686.*|\1|')"
Hans-G?nter@22807 98 else
Hans-G?nter@22807 99 FILE="bitcoin-$version-i686-pc-linux-gnu.tar.gz"
Hans-G?nter@22807 100 WGET_URL="https://bitcoincore.org/bin/bitcoin-core-$version/$FILE"
Hans-G?nter@22807 101 VERSION=$version
pascal@13744 102 fi
pascal@13744 103
Hans-G?nter@22807 104 CUR_DIR=$(pwd)
Hans-G?nter@22807 105 mkdir -p $TMP_DIR
Hans-G?nter@22807 106 cd $TMP_DIR
Hans-G?nter@22807 107 if [ -f $FILE ]
Hans-G?nter@22807 108 then
Hans-G?nter@22807 109 echo "Using existing archive file $FILE"
Hans-G?nter@22807 110 else
Hans-G?nter@22807 111 action "Fetching the archive"
Hans-G?nter@22807 112 newline
Hans-G?nter@22807 113 wget --no-check-certificate $WGET_URL
Hans-G?nter@22807 114 if [ ! -f $FILE ]
Hans-G?nter@22807 115 then
Hans-G?nter@22807 116 cd $CUR_DIR
Hans-G?nter@22807 117 rm -rf $TMP_DIR
Hans-G?nter@22807 118 echo "Could not transfer $FILE from $WGET_URL. Exiting."
Hans-G?nter@22807 119 exit 1
Hans-G?nter@22807 120 fi
Hans-G?nter@22807 121 fi
Hans-G?nter@22807 122
Hans-G?nter@22807 123 # === Extract files from archive ===
Hans-G?nter@22807 124 action "Extracting the archive"
Hans-G?nter@22807 125 newline
Hans-G?nter@22807 126 busybox tar x -f $FILE
Hans-G?nter@22807 127
pascal@13744 128 mkdir -p $PACKAGE-$VERSION/fs/usr/bin
Hans-G?nter@22807 129 mv $PACKAGE-$VERSION/bin/* $PACKAGE-$VERSION/fs/usr/bin
pascal@13744 130
Hans-G?nter@22807 131 # Remove archive file
Hans-G?nter@22807 132 rm -f $FILE
pascal@13744 133
Hans-G?nter@22807 134 # === Create SliTaz package ===
pascal@13744 135
pascal@13744 136 cd $PACKAGE-$VERSION/fs
pascal@13744 137
pascal@13744 138 # Create menu
pascal@13744 139 mkdir -p usr/share/applications
pascal@13744 140 cat > usr/share/applications/$PACKAGE.desktop <<EOT
pascal@13744 141 [Desktop Entry]
pascal@13744 142 Version=1.0
pascal@13744 143 Encoding=UTF-8
pascal@13744 144 Name=$PACKAGE
pascal@14504 145 Exec=/usr/bin/$PACKAGE-qt
pascal@13744 146 Icon=stock_certificate.png
pascal@13744 147 Terminal=false
pascal@13744 148 Categories=Application
pascal@13744 149 Comment=$SHORT_DESC
pascal@13744 150 Type=Application
pascal@13744 151 Categories=Office;
pascal@13744 152 EOT
pascal@13744 153
Hans-G?nter@22807 154 cd ..
Hans-G?nter@22807 155
Hans-G?nter@22807 156 # Create recipe for SliTaz package
Hans-G?nter@22807 157 cat > receipt <<EOT
pascal@13744 158 PACKAGE="$PACKAGE"
pascal@13744 159 VERSION="$VERSION"
pascal@13744 160 CATEGORY="$CATEGORY"
pascal@13744 161 SHORT_DESC="$SHORT_DESC"
pascal@13744 162 MAINTAINER="$MAINTAINER"
pascal@13744 163 DEPENDS="$DEPENDS"
pascal@13744 164 WEB_SITE="$WEB_SITE"
pascal@13744 165 EOT
pascal@13744 166
Hans-G?nter@22807 167 cd $TMP_DIR
Hans-G?nter@22807 168
Hans-G?nter@22807 169 action "Creating the package $PACKAGE..."
pascal@13744 170 # Pack
pascal@13744 171 tazpkg pack $PACKAGE-$VERSION
pascal@13744 172
Hans-G?nter@22807 173 # Remove package tree
pascal@13744 174 rm -rf $PACKAGE-$VERSION
pascal@13744 175
Hans-G?nter@22807 176 # === Install the SliTaz package ===
Hans-G?nter@22807 177 [ "$install" == "yes" ] &&
Hans-G?nter@22807 178 tazpkg install $PACKAGE-$VERSION.tazpkg --root="$root"
pascal@13744 179
Hans-G?nter@22807 180 # === Cleanup ===
Hans-G?nter@22807 181 # Preserve package file, if requested
Hans-G?nter@22807 182 [ "$keep" == "yes" ] &&
Hans-G?nter@22807 183 mv $PACKAGE-$VERSION.tazpkg $CUR_DIR
Hans-G?nter@22807 184
Hans-G?nter@22807 185 # Remove temporary build directory
pascal@13744 186 cd $CUR_DIR
pascal@13744 187 rm -rf $TMP_DIR