le1t0-deprec 2.1.6.057 → 2.1.6.058
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/deprec/recipes/app/passenger.rb +70 -18
- data/lib/deprec/recipes/iptables.rb +8 -9
- data/lib/deprec/recipes/profiles.rb +84 -0
- data/lib/deprec/recipes/redis.rb +2 -7
- data/lib/deprec/recipes/ruby/rvm.rb +75 -0
- data/lib/deprec/recipes/sphinx/thinking_sphinx.rb +3 -3
- data/lib/deprec/recipes/sphinx/ultrasphinx.rb +3 -3
- data/lib/deprec/recipes/syslog/syslog_ng.rb +6 -6
- data/lib/deprec/recipes/ubuntu.rb +35 -0
- data/lib/deprec/recipes/xen.rb +97 -29
- data/lib/deprec/recipes/xentools.rb +97 -58
- data/lib/deprec/templates/iptables/firewall-init.erb +141 -175
- data/lib/deprec/templates/passenger/passenger.conf.erb +1 -1
- data/lib/deprec/templates/redis/redis-conf.erb +225 -45
- data/lib/deprec/templates/ubuntu/getlibs.erb +599 -0
- data/lib/deprec/templates/xentools/{98-custom → 01-mount-devpts.erb} +2 -5
- data/lib/deprec/templates/xentools/98-custom.erb +42 -0
- data/lib/deprec/templates/xentools/99-devpts-umount.erb +14 -0
- data/lib/deprec/templates/xentools/kernel-img.conf.example.erb +10 -0
- data/lib/deprec/templates/xentools/update-grub-xenu.example.erb +4 -0
- data/lib/deprec/templates/xentools/xm.tmpl.erb +20 -48
- data/lib/deprec.rb +15 -1
- metadata +18 -13
- data/lib/deprec/recipes/rvm.rb +0 -32
- data/lib/deprec/templates/iptables/firewall-default.erb +0 -13
- data/lib/deprec/templates/xentools/100-ubuntu-setup +0 -26
- data/lib/deprec/templates/xentools/15-disable-hwclock +0 -40
- data/lib/deprec/templates/xentools/30-disable-gettys +0 -57
- data/lib/deprec/templates/xentools/31-ubuntu-setup +0 -32
- data/lib/deprec/templates/xentools/40-setup-networking +0 -145
- data/lib/deprec/templates/xentools/xen-tools.conf.erb +0 -278
@@ -0,0 +1,599 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#The MIT License
|
3
|
+
#
|
4
|
+
#Copyright (c) 2007 Cappy
|
5
|
+
|
6
|
+
#Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
#of this software and associated documentation files (the "Software"), to deal
|
8
|
+
#in the Software without restriction, including without limitation the rights
|
9
|
+
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
#copies of the Software, and to permit persons to whom the Software is
|
11
|
+
#furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
#The above copyright notice and this permission notice shall be included in
|
14
|
+
#all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
#THE SOFTWARE.
|
23
|
+
#---
|
24
|
+
#Author: Cappy of ubuntuforums.org
|
25
|
+
#Website: http://ubuntuforums.org/showthread.php?t=474790
|
26
|
+
#Version: 2.06
|
27
|
+
#Purpose: Download and install native and non-native libraries
|
28
|
+
#---
|
29
|
+
|
30
|
+
print_usage()
|
31
|
+
{
|
32
|
+
echo "\
|
33
|
+
Usage: getlibs /path/to/binary
|
34
|
+
getlibs -l i386librarytoinstall.so
|
35
|
+
getlibs -p i386packagename
|
36
|
+
getlibs -w www.website.com/i386package.deb
|
37
|
+
getlibs -i /home/$USER/i386package.deb
|
38
|
+
See 'man getlibs' for more commands"
|
39
|
+
clean_up_err
|
40
|
+
}
|
41
|
+
|
42
|
+
clean_up()
|
43
|
+
{
|
44
|
+
rm -rf $tempdir #Normal exit without errors
|
45
|
+
}
|
46
|
+
|
47
|
+
clean_up_err()
|
48
|
+
{
|
49
|
+
rm -rf $tempdir
|
50
|
+
exit 1 #Exit code 1
|
51
|
+
}
|
52
|
+
|
53
|
+
wget_fail()
|
54
|
+
{
|
55
|
+
echo "\
|
56
|
+
The mirrors do not have the requested file or there is no internet connection"
|
57
|
+
#clean_up_err
|
58
|
+
}
|
59
|
+
|
60
|
+
#Trap exits
|
61
|
+
trap clean_up_err 1 2 3 13 15 #Script error or interrupt
|
62
|
+
trap clean_up 0 #Normal exit
|
63
|
+
PATH="/usr/bin:/bin:/sbin:/usr/sbin:$PATH"; export PATH
|
64
|
+
|
65
|
+
version="Getlibs version 2.06 - March 1st 2008"
|
66
|
+
architecture=`uname -m`
|
67
|
+
targetarch="x86" #Set 64-bit machines to download 32-bit if no options are set
|
68
|
+
if [ "$architecture" != "x86_64" ] && [ "$architecture" != "ia64" ]; then
|
69
|
+
architecture="x86"
|
70
|
+
else
|
71
|
+
architecture="x86_64"
|
72
|
+
fi
|
73
|
+
tempdir=`mktemp -d /tmp/getlibs.XXXXXXXXXX || echo "Unable to create temp directory in /tmp"; clean_up_err`
|
74
|
+
shopt -s xpg_echo
|
75
|
+
#Get distro and release
|
76
|
+
distro=`lsb_release -i | cut -f2`
|
77
|
+
if [ "$distro" = "Ubuntu" ]; then
|
78
|
+
release=`lsb_release -c | cut -f2` #dapper, edgy, gutsy, etc.
|
79
|
+
else
|
80
|
+
if [ "$architecture" = "x86_64" ]; then
|
81
|
+
if [ -d /emul/ia32-linux ]; then
|
82
|
+
distro="Debian"
|
83
|
+
else
|
84
|
+
distro="Ubuntu"; release="gutsy";
|
85
|
+
fi
|
86
|
+
else
|
87
|
+
distro="Debian"
|
88
|
+
fi
|
89
|
+
fi
|
90
|
+
|
91
|
+
#If 64-bit ubuntu and ia32-libs is not installed
|
92
|
+
if [ "$architecture" = "x86_64" ] && [ "$distro" = "Ubuntu" ] && [ ! -e "/usr/lib32/libGLU.so.1" ]; then
|
93
|
+
sudo apt-get -y install ia32-libs
|
94
|
+
elif [ "$architecture" = "x86_64" ] && [ "$distro" = "Debian" ] && [ ! -d "/emul/ia32-linux" ]; then
|
95
|
+
sudo apt-get -y install ia32-libs
|
96
|
+
fi
|
97
|
+
|
98
|
+
if [ $# -lt 1 ]; then
|
99
|
+
print_usage
|
100
|
+
fi
|
101
|
+
|
102
|
+
|
103
|
+
set -- `getopt -u -a --longoptions="32: 64: binary: library: package: distro: release: file: link: mirror: ldconfig remove: help update version yes verbose apt-file extract build savebuild" "b: l: p: d: r: i: w: m: c r: u v h" "$@"`
|
104
|
+
while [ $# -gt 0 ]; do
|
105
|
+
case "$1" in
|
106
|
+
--32) targetarch="x86";;
|
107
|
+
--64) targetarch="x86_64";;
|
108
|
+
--binary) binarypath="$2"; shift;;
|
109
|
+
-b) binarypath="$2"; shift;;
|
110
|
+
--library) library="true"; parameters="$parameters $2"; shift;;
|
111
|
+
-l) library="true"; parameters="$parameters $2"; shift;;
|
112
|
+
--package) package="true"; parameters="$parameters $2"; shift;;
|
113
|
+
-p) package="true"; parameters="$parameters $2"; shift;;
|
114
|
+
--distro) distro="$2"; shift;;
|
115
|
+
-d) distro="$2"; shift;;
|
116
|
+
--release) release="$2"; shift;;
|
117
|
+
-r) release="$2"; shift;;
|
118
|
+
--file) file="true"; parameters="$parameters $2"; shift;;
|
119
|
+
-i) file="true"; parameters="$parameters $2"; shift;;
|
120
|
+
--link) download="true"; parameters="$parameters $2"; shift;;
|
121
|
+
-w) download="true"; parameters="$parameters $2"; shift;;
|
122
|
+
--mirror) mirror2="$2"; parameters="$parameters $2"; shift;;
|
123
|
+
-m) mirror2="$2"; parameters="$parameters $2"; shift;;
|
124
|
+
--ldconfig) ldconfig="true";;
|
125
|
+
-c) ldconfig="true";;
|
126
|
+
--remove) remove="true"; parameters="$parameters $2"; shift;;
|
127
|
+
-r) remove="true"; parameters="$parameters $2"; shift;;
|
128
|
+
--update) update="true";;
|
129
|
+
-u) update="true";;
|
130
|
+
--version) echo "$version";;
|
131
|
+
-v) echo "$version";;
|
132
|
+
--yes) prompt="yes";;
|
133
|
+
--verbose) verbose="true";;
|
134
|
+
--apt-file) aptfile="true";;
|
135
|
+
--extract) extract="true";;
|
136
|
+
--build) build="true";;
|
137
|
+
--savebuild) savebuild="true";;
|
138
|
+
--help) print_usage;;
|
139
|
+
-h) print_usage;;
|
140
|
+
--) shift; break;;
|
141
|
+
-*) print_usage; exit;;
|
142
|
+
*) break;;
|
143
|
+
esac
|
144
|
+
shift
|
145
|
+
done
|
146
|
+
|
147
|
+
#If no parameters decide if it is a binary or a library
|
148
|
+
if [ -n "$1" ] && [ -z "$library" ] && [ -z "$binarypath" ] && [ -z "$download" ] && [ -z "$package" ] && [ -z "$file" ]; then
|
149
|
+
if [ -n "`echo "$1" | grep "\.so"`" ]; then
|
150
|
+
library="true";
|
151
|
+
else
|
152
|
+
#if [ -f "$1" ]; then
|
153
|
+
binarypath="$1"
|
154
|
+
#else
|
155
|
+
#echo "$1 is not an existing file. Assuming this is a package name.\n"
|
156
|
+
#package="true"
|
157
|
+
#fi
|
158
|
+
fi
|
159
|
+
fi
|
160
|
+
|
161
|
+
while [ $# -gt 0 ]; do
|
162
|
+
if [ "$1" != "--" ]; then
|
163
|
+
parameters="$parameters $1"
|
164
|
+
fi
|
165
|
+
shift
|
166
|
+
done
|
167
|
+
|
168
|
+
not_an_executable()
|
169
|
+
{
|
170
|
+
echo "\
|
171
|
+
Cannot determine the dependencies required by this program, it may be a script:
|
172
|
+
If this program needs a 32-bit library use:
|
173
|
+
getlibs -l i386librarytoinstall.so
|
174
|
+
If this program needs a 64-bit library use:
|
175
|
+
getlibs -64l amd64librarytoinstall.so"
|
176
|
+
clean_up_err
|
177
|
+
}
|
178
|
+
|
179
|
+
#Find missing dependencies for a binary
|
180
|
+
if [ -n "$binarypath" ]; then
|
181
|
+
if [ ! -f "$binarypath" ]; then
|
182
|
+
echo "The file \"$binarypath\" does not exist"
|
183
|
+
print_usage
|
184
|
+
elif [ ! -r "$binarypath" ]; then
|
185
|
+
echo "The file \"$binarypath\" does not have read permissions"
|
186
|
+
clean_up_err
|
187
|
+
elif [ -z "`file "$binarypath" | grep ELF`" ]; then
|
188
|
+
not_an_executable
|
189
|
+
fi
|
190
|
+
|
191
|
+
if [ -n "`file "$binarypath" | grep "32-bit"`" ]; then
|
192
|
+
targetarch="x86"
|
193
|
+
elif [ -n "`file "$binarypath" | grep "64-bit"`" ]; then
|
194
|
+
targetarch="x86_64"
|
195
|
+
else
|
196
|
+
echo "Not a 32-bit or 64-bit binary"; echo `file "$binarypath"`; clean_up_err;
|
197
|
+
fi
|
198
|
+
|
199
|
+
cd `dirname "$binarypath" || echo "cd $binarypath failed"; clean_up_err` #Change to the program's directory
|
200
|
+
binarypath=`basename "$binarypath"`
|
201
|
+
dependencylist=`ldd "$binarypath" | grep "not found" | awk '{print $1}'`
|
202
|
+
|
203
|
+
neededlocallibraries=`echo "$dependencylist" | grep "\./"`
|
204
|
+
if [ -n "$neededlocallibraries" ]; then
|
205
|
+
neededlocallibraries=`echo ${neededlocallibraries//\.\//}`
|
206
|
+
echo "You need to be copy the following libraries to the same directory as the binary:"
|
207
|
+
echo "$neededlocallibraries"
|
208
|
+
dependencylist=`echo "$dependencylist" | grep -v "\./"`
|
209
|
+
fi
|
210
|
+
if [ -z "`echo "$dependencylist" | grep "[[:alpha:]]"`" ]; then
|
211
|
+
echo "This application isn't missing any dependencies"
|
212
|
+
exit
|
213
|
+
fi
|
214
|
+
parameters="$dependencylist"
|
215
|
+
library="true"
|
216
|
+
binarypath="`pwd`/`basename "$binarypath"`"
|
217
|
+
fi
|
218
|
+
|
219
|
+
#Determine how to install library
|
220
|
+
if [ "$architecture" = "$targetarch" ]; then
|
221
|
+
installtype="native" #apt-get
|
222
|
+
elif [ "$architecture" = "x86" ]; then
|
223
|
+
echo "Cannot install 64-bit libraries on a 32-bit system"; clean_up_err;
|
224
|
+
else
|
225
|
+
installtype="nonnative" #32-bit on 64-bit system
|
226
|
+
fi
|
227
|
+
|
228
|
+
while true; do #Loop for incase there are new dependencies created for binary
|
229
|
+
|
230
|
+
returned=""
|
231
|
+
stored_list()
|
232
|
+
{
|
233
|
+
stored="
|
234
|
+
libXss.so.1 libxss1
|
235
|
+
libdbus-1.so.2 libdbus-1.so.3 libdbus-1-3
|
236
|
+
libQtCore.so.4 libQtNetwork.so.4 libQtDBus.so.4 libqt4-core
|
237
|
+
libQtGui.so.4 libqt4-gui
|
238
|
+
libsigc-2.0.so.0 libsigc++-2.0-0c2a
|
239
|
+
libasound_module_pcm_pulse.so libasound2-plugins
|
240
|
+
libglitz-glx.so.1 libglitz-glx1
|
241
|
+
libglitz.so.1 libglitz1
|
242
|
+
librsvg-2.so.2 librsvg2-2
|
243
|
+
libcroco-0.6.so.3 libcroco3
|
244
|
+
libgsf-1.so.114 libgsf-1-114
|
245
|
+
libqt-mt.so.3 libqt3-mt
|
246
|
+
libgtk-1.2.so.0 libgtk1.2
|
247
|
+
libgmodule-1.2.so.0 libglib1.2
|
248
|
+
libSDL-1.2.so.0 libsdl1.2debian-all
|
249
|
+
libXxf86vm.so.1 libxxf86vm1
|
250
|
+
libXxf86dga.so.1 libxxf86dga1
|
251
|
+
libcurl.so.3 libcurl3
|
252
|
+
"
|
253
|
+
found=`echo "$stored" | grep -m 1 "$1" | grep -o "[^ ]*$"`
|
254
|
+
if [ -n "$found" ]; then
|
255
|
+
echo "$found"
|
256
|
+
fi
|
257
|
+
}
|
258
|
+
|
259
|
+
use_web_interface()
|
260
|
+
{
|
261
|
+
PACKAGE=`echo $1 | sed s/\+/%2B/g`
|
262
|
+
if [ "$distro" = "Ubuntu" ]; then
|
263
|
+
searchaddress="http://packages.ubuntu.com/search?searchon=contents&keywords=$PACKAGE&mode=exactfilename&suite=$release&arch=i386"
|
264
|
+
else
|
265
|
+
searchaddress="http://packages.ubuntu.com/search?searchon=contents&keywords=$PACKAGE&mode=exactfilename&suite=gutsy&arch=i386"
|
266
|
+
fi
|
267
|
+
packagenames=`wget --user-agent="getlibs" -q -O- "$searchaddress"`
|
268
|
+
if [ -z "$packagenames" ]; then
|
269
|
+
echo 'Not able to connect to http://packages.ubuntu.com to find the package name'
|
270
|
+
fi
|
271
|
+
packagenames=`echo "$packagenames" | sed -n '/<td class=\"file\">/,/<\/td>/p' | grep -v '"keyword"' | grep -v "\(/debug/\|-dbg\)" | sed 's/<[^>]*>,*//g' | grep -m1 '[[:alnum:]]' | sed 's/[[:space:]]//g'`
|
272
|
+
if [ -n "$packagenames" ]; then
|
273
|
+
echo "$packagenames"
|
274
|
+
fi
|
275
|
+
}
|
276
|
+
|
277
|
+
apt_file()
|
278
|
+
{
|
279
|
+
returned=`apt-file search $1 | grep -m 1 -v "\(debug\|dbg\)" | cut -f1 -d ' '`
|
280
|
+
if [ -n "$returned" ]; then
|
281
|
+
echo ${returned/:/}
|
282
|
+
fi
|
283
|
+
}
|
284
|
+
|
285
|
+
video_drivers() #Attempts to link libGL.so.1 to a driver if libGL.so.1 does not exist
|
286
|
+
{
|
287
|
+
if [ "$installtype" = "native" ]; then
|
288
|
+
videopath="/usr/lib"
|
289
|
+
else
|
290
|
+
videopath="/usr/lib32"
|
291
|
+
fi
|
292
|
+
|
293
|
+
if [ -z "`ls $videopath/libGL.so.* 2> /dev/null`" ]; then
|
294
|
+
echo "libGL is installed from video drivers, please install or reinstall your video drivers"
|
295
|
+
elif [ -f "$videopath/libGL.so.1" ]; then
|
296
|
+
echo "libGL is installed from video drivers, please install or reinstall your video drivers"
|
297
|
+
else
|
298
|
+
videodriver=`ls $videopath/libGL.so.* | grep -o -m 1 '[^ ]*'`
|
299
|
+
ln -s "$videodriver" "$videopath/libGL.so.1"
|
300
|
+
echo "Created symbolic link from $videodriver to $videopath/libGL.so.1"
|
301
|
+
fi
|
302
|
+
}
|
303
|
+
|
304
|
+
#Find the package name using the library filename
|
305
|
+
if [ -n "$library" ]; then
|
306
|
+
packagelist=""
|
307
|
+
for lib in $parameters; do
|
308
|
+
lib=`basename $lib`
|
309
|
+
returned=`stored_list "$lib"`
|
310
|
+
if [ -n "`echo "$lib" | grep "libGL.so."`" ]; then
|
311
|
+
video_drivers
|
312
|
+
elif [ -n "$aptfile" ]; then
|
313
|
+
returned=`apt_file "$lib"`
|
314
|
+
if [ -n "$returned" ]; then
|
315
|
+
packagelist="$packagelist$returned
|
316
|
+
"
|
317
|
+
else
|
318
|
+
echo "Apt-file returned no results for $lib"
|
319
|
+
fi
|
320
|
+
elif [ -n "$returned" ]; then
|
321
|
+
echo "$lib: $returned"
|
322
|
+
packagelist="$packagelist$returned
|
323
|
+
"
|
324
|
+
else
|
325
|
+
returned=`use_web_interface "$lib"`
|
326
|
+
if [ -n "$returned" ]; then
|
327
|
+
echo "$lib: $returned"
|
328
|
+
packagelist="$packagelist$returned
|
329
|
+
"
|
330
|
+
else
|
331
|
+
echo "No match for $lib"
|
332
|
+
fi
|
333
|
+
fi
|
334
|
+
done
|
335
|
+
|
336
|
+
parameters="$packagelist"
|
337
|
+
package="true"
|
338
|
+
fi
|
339
|
+
|
340
|
+
#If it is native it can apt-get and stop here
|
341
|
+
if [ "$installtype" = "native" ]; then
|
342
|
+
if [ "`echo "$parameters" | grep "[[:alpha:]]"`" ]; then
|
343
|
+
sudo apt-get -y install $parameters
|
344
|
+
fi
|
345
|
+
package=""
|
346
|
+
parameters=""
|
347
|
+
exit
|
348
|
+
fi
|
349
|
+
|
350
|
+
if [ -n "$package" ] && [ "`echo "$parameters" | grep "[[:alpha:]]"`" ]; then #If there are packages to download
|
351
|
+
#Sort list of names and download links
|
352
|
+
parameters=`echo "$parameters" | sort -u`
|
353
|
+
echo -n "The following i386 packages will be installed:"
|
354
|
+
echo "$parameters"
|
355
|
+
prompt="Y"
|
356
|
+
if [ -z "$prompt" ]; then
|
357
|
+
echo -n "Continue [Y/n]? "
|
358
|
+
read prompt
|
359
|
+
fi
|
360
|
+
case $prompt in
|
361
|
+
[nN]) clean_up_err;;
|
362
|
+
[nN][oO]) clean_up_err;;
|
363
|
+
[yY]) ;;
|
364
|
+
[yY][eE][sS]) ;;
|
365
|
+
"") ;;
|
366
|
+
*) echo "Not understood. Aborting."; clean_up_err;; #Default to no
|
367
|
+
esac
|
368
|
+
else
|
369
|
+
if [ -n "$verbose" ]; then
|
370
|
+
echo "No packages to download"
|
371
|
+
fi
|
372
|
+
fi
|
373
|
+
|
374
|
+
#Find the download link using the name of the package
|
375
|
+
if [ -n "$package" ]; then
|
376
|
+
links=""
|
377
|
+
mirrorlist=""
|
378
|
+
for pack in $parameters; do
|
379
|
+
templink=`apt-cache --no-all-versions show $pack | grep -o -m 1 '[^ ]*\.deb$'`
|
380
|
+
if [ -n "$templink" ]; then
|
381
|
+
linkmirror="`apt-cache policy $pack | grep -m 1 -i -o '\(http:\|www.\|ftp:\|https:\)[^ ]*'`"
|
382
|
+
if [ -n "$linkmirror" ]; then
|
383
|
+
if [ -f "/etc/apt/sources.list" ]; then
|
384
|
+
linkmirror=`grep -o -m 1 "$linkmirror[^ ]*" /etc/apt/sources.list`
|
385
|
+
elif [ -f "/etc/apt/sources.lst" ]; then
|
386
|
+
linkmirror=`grep -o -m 1 "$linkmirror[^ ]*" /etc/apt/sources.lst`
|
387
|
+
else
|
388
|
+
echo "/etc/apt/sources.list not found"
|
389
|
+
fi
|
390
|
+
if [ -n "$linkmirror" ]; then
|
391
|
+
if [ -z "`echo $linkmirror | grep '/$'`" ]; then
|
392
|
+
linkmirror="$linkmirror/"
|
393
|
+
fi
|
394
|
+
mirrorlist="$mirrorlist$linkmirror "
|
395
|
+
templink="$linkmirror$templink"
|
396
|
+
fi
|
397
|
+
fi
|
398
|
+
if [ -n "$verbose" ]; then
|
399
|
+
echo "queue: $templink"
|
400
|
+
echo "mirror: $linkmirror"
|
401
|
+
fi
|
402
|
+
links="$links $templink"
|
403
|
+
else
|
404
|
+
echo "$pack was not found in your repositories"
|
405
|
+
echo "Make sure you have all repositories enabled and updated"
|
406
|
+
fi
|
407
|
+
done
|
408
|
+
links=`echo ${links//amd64\.deb/i386\.deb}`
|
409
|
+
mirrorlist=`echo "$mirrorlist" | sort -u`
|
410
|
+
parameters="$links"
|
411
|
+
link="true"
|
412
|
+
fi
|
413
|
+
|
414
|
+
if [ -z "$mirror" ]; then
|
415
|
+
if [ "$distro" = "Ubuntu" ]; then
|
416
|
+
mirror2='http://mirrors.kernel.org/ubuntu/'
|
417
|
+
else
|
418
|
+
mirror2='http://mirrors.kernel.org/debian/'
|
419
|
+
fi
|
420
|
+
fi
|
421
|
+
|
422
|
+
#Create the links to the packages
|
423
|
+
if [ -n "$link" ]; then
|
424
|
+
fulllinks=""
|
425
|
+
for eachlink in $parameters; do
|
426
|
+
if [ -z "`echo "$eachlink" | grep -i '\(http:\|www.\|ftp:\|https:\)'`" ]; then
|
427
|
+
if [ -n "$verbose" ]; then
|
428
|
+
echo "$mirror2 is the new mirror for $eachlink"
|
429
|
+
fi
|
430
|
+
fulllinks="$fulllinks $mirror2$eachlink"
|
431
|
+
else
|
432
|
+
fulllinks="$fulllinks $eachlink"
|
433
|
+
fi
|
434
|
+
done
|
435
|
+
|
436
|
+
parameters="$fulllinks"
|
437
|
+
download="true"
|
438
|
+
fi
|
439
|
+
|
440
|
+
#Local file(s) to install
|
441
|
+
if [ -n "$file" ]; then
|
442
|
+
if [ "$architecture" = "x86" ]; then
|
443
|
+
sudo dpkg -i $parameters; exit
|
444
|
+
fi
|
445
|
+
for eachfile in $parameters; do
|
446
|
+
cp $eachfile $tempdir
|
447
|
+
done
|
448
|
+
parameters=""
|
449
|
+
#build="true"
|
450
|
+
fi
|
451
|
+
|
452
|
+
copy_fail()
|
453
|
+
{
|
454
|
+
echo "Copying files failed - run getlibs with \"sudo getlibs\" or as root"
|
455
|
+
clean_up_err
|
456
|
+
}
|
457
|
+
|
458
|
+
#Download and install
|
459
|
+
if [ -n "$download" ] && [ -n "`echo "$parameters" | grep "[[:alpha:]]"`" ]; then
|
460
|
+
echo "Downloading ..."
|
461
|
+
for eachlink in $parameters; do
|
462
|
+
if [ -n "$verbose" ]; then
|
463
|
+
echo "Downloading $eachlink"
|
464
|
+
fi
|
465
|
+
wget -q "--directory-prefix=$tempdir" "$eachlink"
|
466
|
+
if [ $? -ne 0 ]; then
|
467
|
+
echo "Failed to download file $eachlink"
|
468
|
+
for eachmirror in $mirrorlist; do
|
469
|
+
eachlink=`echo ${eachlink//$eachmirror/$mirror2}`
|
470
|
+
done
|
471
|
+
wget -q "--directory-prefix=$tempdir" "$eachlink"
|
472
|
+
if [ $? -ne 0 ]; then
|
473
|
+
wget_fail
|
474
|
+
else
|
475
|
+
echo "$eachlink downloaded successfully from $mirror2"
|
476
|
+
fi
|
477
|
+
fi
|
478
|
+
done
|
479
|
+
#build="true"
|
480
|
+
fi
|
481
|
+
|
482
|
+
|
483
|
+
dpkg_repack() {
|
484
|
+
eachdeb="$1"
|
485
|
+
debdir="`echo $eachdeb | sed 's/.deb//'`"
|
486
|
+
debbase=`basename $debdir`
|
487
|
+
|
488
|
+
dpkg --extract "$eachdeb" "$debdir-tmp"
|
489
|
+
dpkg --control "$eachdeb" "$debdir-tmp/DEBIAN"
|
490
|
+
mkdir -p "$debdir/DEBIAN"
|
491
|
+
cd "$debdir-tmp"
|
492
|
+
|
493
|
+
if [ -d "$debdir-tmp/lib" ]; then
|
494
|
+
mv "lib" "lib32"
|
495
|
+
cp -R "lib32/" "$debdir"
|
496
|
+
fi
|
497
|
+
if [ -d "$debdir-tmp/usr/lib" ]; then
|
498
|
+
mkdir -p "$debdir/usr/"
|
499
|
+
mv "usr/lib" "usr/lib32"
|
500
|
+
cp -R "usr/lib32/" "$debdir/usr"
|
501
|
+
fi
|
502
|
+
|
503
|
+
if [ -f "DEBIAN/md5sums" ]; then
|
504
|
+
grep ' \(usr/lib/\|lib/\)' DEBIAN/md5sums | sed 's+ lib/+ lib32/+g' | sed 's+ usr/lib/+ usr/lib32/+g' > "$debdir/DEBIAN/md5sums"
|
505
|
+
fi
|
506
|
+
|
507
|
+
debarch=`grep 'Architecture:' DEBIAN/control`
|
508
|
+
debpackage=`grep 'Package:' DEBIAN/control`
|
509
|
+
if [ -n "`echo $debpackage | grep lib`" ]; then
|
510
|
+
newdebpackage=`echo ${debpackage/lib/lib32}`
|
511
|
+
else
|
512
|
+
newdebpackage="$debpackage-i386"
|
513
|
+
fi
|
514
|
+
sed "s/$debarch/Architecture: all/g" DEBIAN/control | sed "s/$debpackage/$newdebpackage/" | grep -v 'Depends:' | grep -v 'Conflicts:' | grep -v 'Replaces:' > "$debdir/DEBIAN/control"
|
515
|
+
|
516
|
+
if [ -f "DEBIAN/postinst" ]; then
|
517
|
+
cp "DEBIAN/postinst" "$debdir/DEBIAN"
|
518
|
+
fi
|
519
|
+
if [ -f "DEBIAN/postrm" ]; then
|
520
|
+
cp "DEBIAN/postrm" "$debdir/DEBIAN"
|
521
|
+
fi
|
522
|
+
|
523
|
+
cd "$tempdir/build"
|
524
|
+
dpkg --build "$debdir" "$debbase.deb"
|
525
|
+
echo "Installing new $newdebpackage"
|
526
|
+
sudo dpkg -i "$debbase.deb"
|
527
|
+
if [ -n "$savebuild" ]; then
|
528
|
+
echo "Moving new package $debbase.deb to /home/$USER/"
|
529
|
+
cp $debbase.deb "/home/$USER/"
|
530
|
+
fi
|
531
|
+
}
|
532
|
+
|
533
|
+
if [ -z "`ls $tempdir/*.deb 2> /dev/null`" ]; then
|
534
|
+
echo "No packages to install"
|
535
|
+
exit
|
536
|
+
fi
|
537
|
+
|
538
|
+
if [ -n "$build" ]; then #future default option
|
539
|
+
mkdir "$tempdir/build"
|
540
|
+
for eachdeb in `ls $tempdir/*.deb 2> /dev/null`; do
|
541
|
+
if [ -n "$verbose" ]; then
|
542
|
+
echo "extracting: $eachdeb"
|
543
|
+
fi
|
544
|
+
output=`dpkg_repack "$eachdeb"`
|
545
|
+
done
|
546
|
+
else # --extract
|
547
|
+
for eachdeb in `ls $tempdir/*.deb`; do
|
548
|
+
if [ -n "$verbose" ]; then
|
549
|
+
echo "extracting: $eachdeb"
|
550
|
+
fi
|
551
|
+
dpkg -x "$eachdeb" "$tempdir/extracted"
|
552
|
+
done
|
553
|
+
|
554
|
+
echo "Installing libraries ..."
|
555
|
+
ldconfigparam=""
|
556
|
+
if [ "$distro" = "Ubuntu" ]; then
|
557
|
+
if [ -d $tempdir/extracted/usr/lib/ ]; then #If dir exists (and thus files to move)
|
558
|
+
sudo cp -R $tempdir/extracted/usr/lib/* /usr/lib32/ || copy_fail
|
559
|
+
ldconfigparam="$ldconfigparam/usr/lib32/ "
|
560
|
+
fi
|
561
|
+
if [ -d $tempdir/extracted/lib/ ]; then #If dir exists (and thus files to move)
|
562
|
+
sudo cp -R $tempdir/extracted/lib/* /lib32/ || copy_fail
|
563
|
+
ldconfigparam="$ldconfigparam/lib32/ "
|
564
|
+
fi
|
565
|
+
elif [ "$distro" = "Debian" ]; then
|
566
|
+
sudo cp -R $tempdir/extracted/* /emul/ia32-linux/ || copy_fail
|
567
|
+
ldconfigparam="$ldconfigparam/emul/ia32-linux/ "
|
568
|
+
fi
|
569
|
+
fi
|
570
|
+
|
571
|
+
# --ldconfig
|
572
|
+
if [ -n "$ldconfig" ]; then
|
573
|
+
sudo ldconfig -n $ldconfigparam
|
574
|
+
fi
|
575
|
+
|
576
|
+
#Check binary for new dependencies
|
577
|
+
if [ -n "$binarypath" ]; then
|
578
|
+
runningdependencylist="$runningdependencylist
|
579
|
+
$dependencylist"
|
580
|
+
dependencylist=`ldd "$binarypath" | grep "not found" | awk '{print $1}' | grep -v "\./"`
|
581
|
+
if [ -z "$dependencylist" ]; then
|
582
|
+
exit #All dependencies satisfied
|
583
|
+
fi
|
584
|
+
|
585
|
+
for eachdependency in $runningdependencylist; do
|
586
|
+
dependencylist=`echo ${dependencylist//$eachdependency/}`
|
587
|
+
done
|
588
|
+
dependencylist=`echo "$dependencylist" | grep "[[:alnum:]]"`
|
589
|
+
if [ -n "$dependencylist" ]; then
|
590
|
+
rm -rf $tempdir/*
|
591
|
+
echo "New depedencies have been detected"
|
592
|
+
parameters="$dependencylist"
|
593
|
+
else
|
594
|
+
exit #No new dependencies
|
595
|
+
fi
|
596
|
+
else
|
597
|
+
exit
|
598
|
+
fi
|
599
|
+
done
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
prefix=$1
|
4
|
+
|
5
|
+
#
|
6
|
+
# Source our common functions
|
7
|
+
#
|
8
|
+
if [ -e /usr/lib/xen-tools/common.sh ]; then
|
9
|
+
. /usr/lib/xen-tools/common.sh
|
10
|
+
else
|
11
|
+
. ./hooks/common.sh
|
12
|
+
fi
|
13
|
+
|
14
|
+
export DEBIAN_FRONTEND=noninteractive
|
15
|
+
<% if xentools_custom_commands_pre %><%= xentools_custom_commands_pre %>
|
16
|
+
<% end %><% if xentools_no_utc %>perl -p -i -e 's/UTC=yes/UTC=no/' ${prefix}/etc/default/rcS
|
17
|
+
<% end %><% if xentools_enable_sudo_in_sudoers %>perl -p -i -e 's/# (%sudo)/$1/' ${prefix}/etc/sudoers
|
18
|
+
<% end %><% if xentools_deploy_user %>chroot ${prefix} useradd -G sudo -m -s /bin/bash <%= xentools_deploy_user %>
|
19
|
+
<% end %><% if xentools_deploy_user %>mkdir -p ${prefix}/home/<%= xentools_deploy_user %>/.ssh
|
20
|
+
<% end %><% if xentools_deploy_user %>cp ~/.ssh/authorized_keys ${prefix}/home/<%= xentools_deploy_user %>/.ssh/
|
21
|
+
<% end %><% if xentools_deploy_user %>chmod 700 ${prefix}/home/<%= xentools_deploy_user %>/.ssh
|
22
|
+
<% end %><% if xentools_deploy_user %>chmod 600 ${prefix}/home/<%= xentools_deploy_user %>/.ssh/authorized_keys
|
23
|
+
<% end %><% if xentools_deploy_user && xentools_deploy_group %>chroot ${prefix} chown -R <%= xentools_deploy_user %>:<%= xentools_deploy_group %> /home/<%= xentools_deploy_user %>/.ssh
|
24
|
+
<% end %><% if xentools_copy_localtime %>cp /etc/localtime ${prefix}/etc/
|
25
|
+
<% end %><% if xentools_disable_hwclock %>chmod 644 ${prefix}/sbin/hwclock
|
26
|
+
cat <<EOF >${prefix}/etc/init.d/disable-hwclock
|
27
|
+
#!/bin/bash
|
28
|
+
|
29
|
+
chmod 644 /sbin/hwclock
|
30
|
+
|
31
|
+
EOF
|
32
|
+
chmod 755 ${prefix}/etc/init.d/disable-hwclock
|
33
|
+
chroot ${prefix} /usr/sbin/update-rc.d disable-hwclock start 03 0 6 . stop 03 0 6 .
|
34
|
+
<% end %><% if xentools_dist_upgrade %>chroot ${prefix} /usr/bin/apt-get -y dist-upgrade
|
35
|
+
<% end %><% if xentools_default_bootloader %>mkdir -p ${prefix}/usr/local/bin/
|
36
|
+
cp /usr/local/share/xen-tools/update-grub-xenu.example ${prefix}/usr/local/bin/update-grub-xenu
|
37
|
+
cp /usr/local/share/xen-tools/kernel-img.conf.example ${prefix}/etc/kernel-img.conf
|
38
|
+
chmod 755 ${prefix}/usr/local/bin/update-grub-xenu
|
39
|
+
installDebianPackage ${prefix} linux-xen
|
40
|
+
<% end %><% if xentools_disable_hwclock %>chmod 644 ${prefix}/sbin/hwclock
|
41
|
+
<% end %><% if xentools_custom_commands_post %><%= xentools_custom_commands_post %>
|
42
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Kernel image management overrides
|
2
|
+
# See kernel-img.conf(5) for details
|
3
|
+
do_symlinks = yes
|
4
|
+
relative_links = yes
|
5
|
+
do_bootloader = no
|
6
|
+
do_bootfloppy = no
|
7
|
+
do_initrd = yes
|
8
|
+
link_in_boot = no
|
9
|
+
postinst_hook = /usr/local/bin/update-grub-xenu
|
10
|
+
postrm_hook = /usr/local/bin/update-grub-xenu
|
@@ -0,0 +1,4 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
mkdir -p /boot/grub
|
4
|
+
find /boot -name "vmlinuz-2.6.*-xen" | awk -v root="$(cat /etc/fstab | awk '{ if($2=="/") { print $1; }; }')" -F "-" 'BEGIN { v=0; kv=0; uv=0; } { gsub("\.", "-"); nv=$4*1000000+$5; if(nv>v) { v=nv; uv=$5; kv=$4; } ; } END { kernel="2.6."kv"-"uv"-xen"; print "title TruvoLabs"; print "kernel /boot/vmlinuz-"kernel" root="root" ro"; print "initrd /boot/initrd.img-"kernel; }' > /boot/grub/menu.lst
|