debian-cd-clone/tools/update_tasks

104 lines
2.5 KiB
Plaintext
Raw Normal View History

#!/bin/sh
2008-06-07 00:27:20 +00:00
set -e
CODENAME="$1"
if [ -z "$CODENAME" ]; then
echo "usage: update_tasks CODENAME" >&2
exit 1
fi
if [ "$MIRROR"x == ""x ] ; then
echo "update_tasks needs to know where the mirror is" >&2
exit 1
fi
update_full_list () {
file=$1
tasklist=$2
pkgfile=$3
grep '\*' $file > $file.new
(grep -Ev "^(#.*)?[[:space:]]*$" $tasklist ; echo DONE ; cat $pkgfile) | awk '
/DONE/ {
in_packages = 1
next
}
/.*/ {
if (!in_packages) {
name=sprintf("(^| )%s(,|$)", $1)
tasklist[name] = 1
num_tasks++
}
}
/^Package: / {
if (in_packages) {
pkgname = $2
next
}
}
/^Task: / {
if (in_packages) {
for (taskname in tasklist) {
if (match($0, taskname)) {
print pkgname
next
}
}
}
next
}' | sort -u >> $file.new
mv $file.new $file
}
update_essential_list () {
file=$1
tasklist=$2
desktoptask=$3
tasksel=$4
grep '\*' $file > $file.new
for i in $(grep -Ev "^(#.*)?[[:space:]]*$" $tasklist); do
if ( [ "$i" != gnome-dekstop ] &&
[ "$i" != kde-desktop ] &&
[ "$i" != xfce-desktop ] ) ||
[ "$i" = "$desktoptask" ]; then
grep-dctrl -F Task -e "^$i$" $tasksel/usr/share/tasksel/debian-tasks.desc |
grep-dctrl -s Key -n -e '.*';
fi
done | sed -e 's? *??' | grep -v ^$ >> $file.new
mv $file.new $file
}
# We need to gunzip a copy of the appropriate Packages.gz file
# Assume i386, use the $CODENAME main Packages file
TMP_PKG=$BDIR/Packages
zcat $MIRROR/dists/$CODENAME/main/binary-i386/Packages.gz > $TMP_PKG
# Now grab the appropriate tasksel package
TASKSEL_DEB=$MIRROR/`awk '
/^Package: tasksel-data$/ { found=1 }
/^Filename:/ { if (found==1) { print $2; exit } }' $TMP_PKG`
dpkg -x $TASKSEL_DEB $BDIR/tasksel
update_essential_list tasks/task-essential-$CODENAME \
tasks/task.list gnome-desktop \
$BDIR/tasksel
update_essential_list tasks/task-essential-$CODENAME-kde \
tasks/task.list.kde kde-desktop \
$BDIR/tasksel
update_essential_list tasks/task-essential-$CODENAME-xfce \
tasks/task.list.xfce xfce-desktop \
$BDIR/tasksel
update_full_list tasks/task-full-$CODENAME \
tasks/task.list $TMP_PKG
update_full_list tasks/task-full-$CODENAME-kde \
tasks/task.list.kde $TMP_PKG
update_full_list tasks/task-full-$CODENAME-xfce \
tasks/task.list.xfce $TMP_PKG