root / Whitix / branches / hybrid / user / portdownload.sh

Revision 278, 0.7 kB (checked in by mwhitworth, 6 months ago)

Add touch to portdownload.sh, to ensure it exists.

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3#Check for at least an action and package name.
4EXPECTED_ARGS=2
5E_BADARGS=65
6
7if [ $# -lt $EXPECTED_ARGS ]
8then
9        echo "Usage: `basename $0` -{i,u} [package names]"
10        exit $E_BADARGS
11fi
12
13touch portlist
14
15if [ $1 = "-i" ]
16then
17        if [ `grep '$2' portlist` = ""]
18        then
19                WGET_OUTPUT=$(2>&1 wget --progress=dot:mega "http://www.whitix.org/downloads/ports/$2.tar.gz")
20                if [ $? -ne 0 ]
21                then
22                        echo 1>&2 $0: "$WGET_OUTPUT" Exiting.
23                        exit 1
24                fi
25                tar -zxvf $2.tar.gz
26                rm $2.tar.gz
27                echo -e "$2\n" >> portlist
28        fi
29        exit 0
30fi
31
32if [ $1 = "-u" ]
33then
34        if [ `grep '$2' portlist` != ""]
35        then
36                rm -rf $2
37                sed '/$2/ d' `echo portlist` > portlist
38        fi
39        exit 0
40fi
Note: See TracBrowser for help on using the browser.