wok-6.x view get-bitcoin/stuff/get-bitcoin @ rev 15325
Up tcpdump (4.4.0)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Sep 27 21:59:48 2013 +0000 (2013-09-27) |
parents | 3f48e3a93cd7 |
children | c07aaa614a02 |
line source
1 #!/bin/sh -e
3 PACKAGE="$(basename $0 | sed 's/get-//')"
4 CATEGORY="misc"
5 WEB_SITE="http://$PACKAGE.org/"
6 SHORT_DESC="New digital currency for instant payments to anyone, anywhere."
7 MAINTAINER="somebody@$PACKAGE.org"
8 DEPENDS="libQtGui bzlib"
10 ROOT="$1"
11 [ -d "$ROOT" ] || ROOT=""
13 if test $(id -u) != 0 ; then
14 echo -e "\nYou must be root to run `basename $0`."
15 echo -e "Please type 'su' and root password to become super-user.\n"
16 exit 0
17 fi
19 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
20 [ -n "$ROOT" ] && exit 1
21 tazpkg remove $PACKAGE
22 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
23 fi
25 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
26 CUR_DIR=$(pwd)
27 mkdir -p $TMP_DIR && cd $TMP_DIR
29 # Download tarball
30 URL=$(wget -O - $WEB_SITE/en/download | sed \
31 '/linux.tar/!d;s/.*href="\([^"]*\).*/\1/;s|/download$||')
32 FILE="$(basename $URL)"
33 VERSION="$(echo $FILE | sed 's/.*coin-\(.*\)-linux.tar.*/\1/')"
34 wget -O $FILE "$URL"
36 if [ ! -f $FILE ]; then
37 cd $CUR_DIR
38 rm -rf $TMP_DIR
39 echo "Could not download $FILE from $URL. Exiting."
40 exit 1
41 fi
43 mkdir -p $PACKAGE-$VERSION/fs/usr/bin
44 tar xzf $FILE
46 mv $PACKAGE-$VERSION-linux/bin/32/* $PACKAGE-$VERSION/fs/usr/bin
47 rm -rf $PACKAGE-$VERSION-linux
49 # extracted pkg can be removed: Save RAM
50 rm -f $FILE
52 cd $PACKAGE-$VERSION/fs
54 # Create menu
55 mkdir -p usr/share/applications
56 cat > usr/share/applications/$PACKAGE.desktop <<EOT
57 [Desktop Entry]
58 Version=1.0
59 Encoding=UTF-8
60 Name=$PACKAGE
61 Exec=/usr/bin/$PACKAGE-qt
62 Icon=stock_certificate.png
63 Terminal=false
64 Categories=Application
65 Comment=$SHORT_DESC
66 Type=Application
67 Categories=Office;
68 EOT
69 cd ../..
71 cat > $PACKAGE-$VERSION/receipt <<EOT
72 PACKAGE="$PACKAGE"
73 VERSION="$VERSION"
74 CATEGORY="$CATEGORY"
75 SHORT_DESC="$SHORT_DESC"
76 MAINTAINER="$MAINTAINER"
77 DEPENDS="$DEPENDS"
78 WEB_SITE="$WEB_SITE"
79 EOT
81 # Pack
82 tazpkg pack $PACKAGE-$VERSION
84 # Clean to save RAM memory
85 rm -rf $PACKAGE-$VERSION
87 # Install pseudo package
88 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
89 case " $@ " in
90 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
91 esac
93 # Clean
94 cd $CUR_DIR
95 rm -rf $TMP_DIR