wok-next view get-src2pkg/stuff/get-src2pkg @ rev 21013
Small updates
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sun Oct 14 05:29:23 2018 +0300 (2018-10-14) |
parents | 29cefb03f298 |
children |
line source
1 #!/bin/sh -e
3 PACKAGE="src2pkg"
4 WEB_SITE="http://distro.ibiblio.org/amigolinux/download/src2pkg"
6 ROOT="$1"
7 [ -d "$ROOT" ] || ROOT=""
9 if test $(id -u) != 0 ; then
10 echo -e "\nYou must be root to run `basename $0`."
11 echo -e "Please type 'su' and root password to become super-user.\n"
12 exit 0
13 fi
15 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
16 [ -n "$ROOT" ] && exit 1
17 tazpkg remove $PACKAGE
18 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
19 fi
21 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
22 CUR_DIR=$(pwd)
23 mkdir -p $TMP_DIR && cd $TMP_DIR
25 URL="$(wget -O - $WEB_SITE | sed '/src2pkg-/!d;s/.*href="\([^"]*\).*/\1/;q')"
26 FILE="$(wget -O - $WEB_SITE/$URL | sed '/tazpkg/!d;s/.*href="\([^"]*\).*/\1/')"
27 wget $WEB_SITE/$URL$FILE
29 # Install pseudo package
30 tazpkg install $FILE --root=$ROOT
31 case " $@ " in
32 *\ --k*) mv $FILE $CUR_DIR ;;
33 esac
35 # Clean
36 cd $CUR_DIR
37 rm -rf $TMP_DIR