ubuntuusers.de

not_std.sh

Autor:
Kelhim
Datum:
29. Juli 2014 17:24
Code:
 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
#!/bin/bash
if ! [ "$1" = "--i386" ] && ! [ "$1" = "--amd64" ]
then
	echo Missing or invalid argument: "$1"
	exit 1
fi

cd /tmp
if [ ! -f manifest-i386 ]
then
	wget -qO manifest-i386 "http://releases.ubuntu.com/trusty/ubuntu-14.04.1-desktop-i386.manifest"
fi
if [ ! -f manifest-amd64 ]
then
	wget -qO manifest-amd64 "http://releases.ubuntu.com/trusty/ubuntu-14.04.1-desktop-amd64.manifest"
fi

pkgs=("${@:2}")
extra=()

for pkg in ${pkgs[@]}
do
	if [ "$1" = "--i386" ] && ! grep -q "$pkg" manifest-i386
	then
		extra+=("$pkg")
	elif [ "$1" = "--amd64" ] && ! grep -q "$pkg" manifest-amd64
	then
		extra+=("$pkg")
	fi
done

printf -- '%s\n' "${extra[@]}"