wok view get-bitcoin/stuff/get-bitcoin @ rev 23675

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