wok-next view get-litecoin/stuff/get-litecoin @ rev 17839

Add ijs
author Richard Dunbar <mojo@slitaz.org>
date Mon Mar 23 17:00:05 2015 -0400 (2015-03-23)
parents
children
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 | sed '/linux.tar/!d;;s/.*href="\([^"]*\).*/\1/')
31 FILE="$(basename $URL)"
32 VERSION="$(echo $FILE | sed 's/.*coin-\(.*\)-linux.tar.*/\1/')"
33 wget -O $FILE "$URL"
35 if [ ! -f $FILE ]; then
36 cd $CUR_DIR
37 rm -rf $TMP_DIR
38 echo "Could not download $FILE from $URL. Exiting."
39 exit 1
40 fi
42 mkdir -p $PACKAGE-$VERSION/fs/usr/bin
43 tar xzf $FILE
45 mv $PACKAGE-$VERSION-linux/bin/32/* $PACKAGE-$VERSION/fs/usr/bin
46 rm -rf $PACKAGE-$VERSION-linux
48 # extracted pkg can be removed: Save RAM
49 rm -f $FILE
51 cd $PACKAGE-$VERSION/fs
53 # Create menu
54 mkdir -p usr/share/applications
55 cat > usr/share/applications/$PACKAGE.desktop <<EOT
56 [Desktop Entry]
57 Version=1.0
58 Encoding=UTF-8
59 Name=$PACKAGE
60 Exec=/usr/bin/$PACKAGE-qt
61 Icon=stock_certificate.png
62 Terminal=false
63 Categories=Application
64 Comment=$SHORT_DESC
65 Type=Application
66 Categories=Office;
67 EOT
68 cd ../..
70 cat > $PACKAGE-$VERSION/receipt <<EOT
71 PACKAGE="$PACKAGE"
72 VERSION="$VERSION"
73 CATEGORY="$CATEGORY"
74 SHORT_DESC="$SHORT_DESC"
75 MAINTAINER="$MAINTAINER"
76 DEPENDS="$DEPENDS"
77 WEB_SITE="$WEB_SITE"
78 EOT
80 # Pack
81 tazpkg pack $PACKAGE-$VERSION
83 # Clean to save RAM memory
84 rm -rf $PACKAGE-$VERSION
86 # Install pseudo package
87 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
88 case " $@ " in
89 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
90 esac
92 # Clean
93 cd $CUR_DIR
94 rm -rf $TMP_DIR