source: people/tomop/vine-upload/usr/bin/vine-upload @ 6148

Revision 6148, 1.4 KB checked in by tomop, 12 years ago (diff)

added an user-directory "tomop".

  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3if [ $# -lt 2 ]; then
4  echo "usage: $0 dir pkg1 [pkg2 [...]]" >&2
5  exit 1
6fi
7
8if [ ! -f ~/.vine-upload/account ]; then
9  echo "account not found." >&2
10  exit 1
11fi
12
13SECURITY=no
14TEMPLATE=/etc/vine-upload/lftp-template.txt
15
16case $1 in
17  seed)
18    DIR=VineSeed
19    ;;
20  pu6)
21    DIR=VineLinux/6
22    ;;
23  plus6)
24    DIR=VinePlus/6
25    ;;
26  pu5)
27    DIR=VineLinux/5
28    ;;
29  plus5)
30    DIR=VinePlus/5
31    ;;
32  security6)
33    SECURITY=yes
34    DIR=6
35    TEMPLATE=/etc/vine-upload/lftp-template-security.txt
36    ;;
37  security5)
38    SECURITY=yes
39    DIR=5
40    TEMPLATE=/etc/vine-upload/lftp-template-security.txt
41    ;;
42  *)
43    echo "invalid parameter: $1" >&2
44    exit 1
45    ;;
46esac
47
48shift
49
50if [ ! -f $TEMPLATE ]; then
51  echo "script not found." >&2
52  exit 1
53fi
54
55. ~/.vine-upload/account
56
57if [ $SECURITY == "yes" ]; then
58  if [ "x$SECURITY_USERNAME" == "x" ]; then
59    echo "account is empty." >&2
60    exit 1
61  fi
62  USERNAME=$SECURITY_USERNAME
63  PASSWORD=$SECURITY_PASSWORD
64else
65  if [ "x$USERNAME" == "x" ]; then
66    echo "account is empty." >&2
67    exit 1
68  fi
69fi
70
71for f in $@; do
72  for s in /etc/vine-upload/checks.d/*.sh; do
73    if [ ! -f $f ]; then
74      echo "$f: not found." >&2
75      exit 1
76    fi
77
78    $s $f
79
80    RET=$?
81    if [ $RET -ne 0 ]; then
82      exit $RET
83    fi
84  done
85done
86
87cat $TEMPLATE | \
88sed -e "s|#USERNAME#|${USERNAME}|" \
89    -e "s|#PASSWORD#|${PASSWORD}|" \
90    -e "s|#DIR#|${DIR}|" \
91    -e "s|#FILES#|${@}|" | \
92lftp
93
94exit $?
95
Note: See TracBrowser for help on using the repository browser.