wok view get-src2pkg/stuff/get-src2pkg @ rev 23702

Up tazlito (525)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Apr 28 07:57:17 2020 +0000 (2020-04-28)
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