blob: adeab02cbae4ded01a8825f9f4568f954e8f58ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
#!/bin/sh
#
# getpkg - retrieves a single package from package server
#
# Author: Matthew D. Franz <mdfranz@io.com>
#
# $1 - name of package
# $2 - URL of server
#
############################################################################
[ -d /var/pkg/contents ] || mkdir -p /var/pkg/contents
# if in current directory, call pkgadd
if [ -f "$1" ]
then
pkgadd $i
else
if [ -f /etc/tux/config/localpkg ]
then
print "Using local package repository"
if [ -f /etc/proc/fixed ]
then
print "Found /etc/proc/fixed"
fi
fi
fi
if [ -f /etc/tux/config/proxy ]
then
SNARF_PROXY=`cat /etc/tux/config/proxy`
export SNARF_PROXY
fi
mkdir /etc/init.d/running 2> /dev/null
if [ "$1" = "list" ]
then
pkglist
exit
fi
if [ "$1" = "all" ]
then
echo "Downloading all packages..."
if [ ! -f /etc/tux/config/eth0 ]
then
echo "Network was not configured"
if dmesg | grep eth0 > /dev/null
then
echo -n "Attempting DHCP on eth0: "
if dhcpcd > /dev/null 2> /dev/null
then
echo "Successful"
else
echo "Failed"
exit
fi
else
echo "No ethernet interfaces were found"
exit
fi
fi
if [ -f /etc/tux/config/pkglist ]
then
pkglist=`cat /etc/tux/config/pkglist`
for i in $pkglist
do
getpkg $i
done
else
echo "No package list found, retrieving a minimal set"
getpkg baselib
getpkg term
getpkg vi
getpkg tcpdump
fi
exit
fi
if [ "$1" = "" ]
then
echo; echo "You did not specify a package or server!"; echo
echo "getpkg all will load all the packages from /etc/tux/config/pkglist"
getpkg all
else
if [ "$2" = "" ]
then
if [ "$URL" = "" ]
then
if [ -f /etc/tux/config/server ]
then
blah=1
else
echo -n "Enter URL for package retrieval: "
read URL
if [ "$URL" != "" ]
then
echo "Using $URL as your package server from now on..."
echo "$URL" > /etc/tux/config/server
fi
fi
fi
else
URL=$2
fi
if echo $1 | grep tgz > /dev/null
then
FILE=$1
else
FILE=$1.tgz
fi
cd /
PREFIX=`basename $FILE ".tgz"`
#echo $PREFIX
MODPKGNAME=`echo ${1} | cut -d'/' -f2`
if echo $MODPKGNAME | grep tgz > /dev/null
then
MODPKGNAME=`basename $MODPKGNAME ".tgz"`
fi
# Loop through servers listed in
for URL in `cat /etc/tux/config/server`
do
if snarf $URL - > /dev/null 2> /dev/null
then
echo "Retrieving ${URL}${FILE}"
output=`snarf ${URL}/${FILE} - | gunzip -c | tar xvf -`
fi
echo $output > /var/pkg/contents/$PREFIX
if [ -f /etc/init.d/${PREFIX} ]
then
chmod a+x /etc/init.d/${PREFIX} 2> /dev/null
echo; echo "Initializing ${PREFIX}"
/etc/init.d/${PREFIX} 2> /dev/null
fi
if [ "$MODPKGNAME" ]
then
chmod a+x /etc/init.m/${MODPKGNAME} 2> /dev/null
if [ -x /etc/init.m/$MODPKGNAME ]
then
/etc/init.m/$MODPKGNAME
echo "Initializing $1 modules"
fi
fi
break
done
[ $? -eq 0 ] || exit 1
fi
|