2006-12-29 05:05:30 -01:00
|
|
|
#!/bin/sh
|
2008-06-07 00:27:20 +00:00
|
|
|
set -e
|
2006-12-29 05:05:30 -01:00
|
|
|
|
|
|
|
if [ -z "$CODENAME" ]; then
|
2008-11-13 22:19:30 -01:00
|
|
|
echo "update_tasks: codename not specified" >&2
|
2008-06-07 00:31:58 +00:00
|
|
|
exit 1
|
2006-12-29 05:05:30 -01:00
|
|
|
fi
|
|
|
|
|
2008-10-12 23:08:57 +00:00
|
|
|
if [ "$MIRROR"x = ""x ] ; then
|
2008-11-13 22:19:30 -01:00
|
|
|
echo "update_tasks: mirror dir not specified" >&2
|
2008-06-07 00:02:36 +00:00
|
|
|
exit 1
|
2006-12-29 05:05:30 -01:00
|
|
|
fi
|
|
|
|
|
2008-10-12 23:08:57 +00:00
|
|
|
if [ "$BDIR"x = ""x ] ; then
|
2008-11-13 22:19:30 -01:00
|
|
|
echo "update_tasks: temp dir not specified" >&2
|
2008-10-12 23:54:01 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2008-11-13 22:19:30 -01:00
|
|
|
TDIR=$BDIR/update_tasks
|
2008-10-12 23:54:01 +00:00
|
|
|
mkdir -p $TDIR
|
|
|
|
|
2008-12-05 13:12:10 -01:00
|
|
|
# Sort primary and secondary tasks and add language tasks for both
|
|
|
|
# Secondary tasks are indicated by a "-" suffix in the task.list file
|
|
|
|
# When adding language tasks, 'desktop' is sorted before '*-desktop'
|
|
|
|
expand_task_list () {
|
|
|
|
tasklist=$1
|
|
|
|
langlist=$2
|
|
|
|
|
|
|
|
# Filter out comments, empty lines and secondary tasks
|
|
|
|
task_essential="$(grep -Ev "^(#.*)?(.*-)?[[:space:]]*$" $tasklist)"
|
|
|
|
# Select only secondary tasks
|
|
|
|
task_extra="$(grep -Ev "^(#.*)?[[:space:]]*$" $tasklist | \
|
|
|
|
grep -E "(.*-)[[:space:]]*$" | sed "s/[[:space:]]*-.*$//")"
|
|
|
|
|
|
|
|
echo "# Main tasks" >$tasklist.essential
|
|
|
|
echo "$task_essential" >>$tasklist.essential
|
|
|
|
|
|
|
|
echo >>$tasklist.essential
|
|
|
|
echo "# Main language tasks" >>$tasklist.essential
|
|
|
|
for task in "" $(echo "$task_essential" | grep "^desktop" || true) \
|
|
|
|
$(echo "$task_essential" | grep -- "-desktop" || true); do
|
|
|
|
for language in $(cat $langlist); do
|
|
|
|
echo $language${task:+-$task}
|
|
|
|
done
|
|
|
|
done >>$tasklist.essential
|
|
|
|
|
|
|
|
cp $tasklist.essential $tasklist.full
|
|
|
|
|
|
|
|
if [ "$task_extra" ]; then
|
|
|
|
echo >>$tasklist.full
|
|
|
|
echo "# Extra tasks" >>$tasklist.full
|
|
|
|
echo "$task_extra" >>$tasklist.full
|
|
|
|
|
|
|
|
echo >>$tasklist.full
|
|
|
|
echo "# Extra language tasks" >>$tasklist.full
|
|
|
|
for task in $(echo "$task_extra" | grep "^desktop" || true) \
|
|
|
|
$(echo "$task_extra" | grep -- "-desktop" || true); do
|
|
|
|
for language in $(cat $langlist); do
|
|
|
|
echo $language${task:+-$task}
|
|
|
|
done
|
|
|
|
done >>$tasklist.full
|
|
|
|
fi
|
|
|
|
}
|
2008-10-12 23:08:57 +00:00
|
|
|
|
2006-12-29 05:05:30 -01:00
|
|
|
update_full_list () {
|
2008-06-07 00:31:58 +00:00
|
|
|
file=$1
|
|
|
|
tasklist=$2
|
2008-06-07 00:02:36 +00:00
|
|
|
pkgfile=$3
|
2006-12-29 05:05:30 -01:00
|
|
|
|
2008-06-07 19:03:45 +00:00
|
|
|
(grep -Ev "^(#.*)?[[:space:]]*$" $tasklist ; echo DONE ; cat $pkgfile) | mawk '
|
2008-06-07 00:02:36 +00:00
|
|
|
/DONE/ {
|
|
|
|
in_packages = 1
|
|
|
|
next
|
|
|
|
}
|
|
|
|
/.*/ {
|
|
|
|
if (!in_packages) {
|
2008-06-07 19:03:45 +00:00
|
|
|
tasklist[$1] = num_tasks
|
2008-06-07 00:02:36 +00:00
|
|
|
num_tasks++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^Package: / {
|
|
|
|
if (in_packages) {
|
|
|
|
pkgname = $2
|
|
|
|
next
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^Task: / {
|
|
|
|
if (in_packages) {
|
2008-06-07 19:31:29 +00:00
|
|
|
# Parse the Tasks: line, splitting into array "these"
|
2008-06-07 19:03:45 +00:00
|
|
|
gsub("Task: ", "", $0)
|
|
|
|
gsub(",", "", $0)
|
|
|
|
split($0, these)
|
2008-06-07 19:31:29 +00:00
|
|
|
|
|
|
|
# And see if we have any matches
|
|
|
|
for (task in these) {
|
|
|
|
for (taskname in tasklist) {
|
2008-06-07 19:03:45 +00:00
|
|
|
if (these[task] == taskname) {
|
|
|
|
printf("%d:%s\n", tasklist[taskname], pkgname)
|
|
|
|
next
|
|
|
|
}
|
2008-06-07 00:02:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
next
|
2008-11-13 22:19:30 -01:00
|
|
|
}' | sort -n | cut -d: -f2 > $file
|
2006-12-29 05:05:30 -01:00
|
|
|
}
|
|
|
|
|
|
|
|
update_essential_list () {
|
2008-06-07 00:31:58 +00:00
|
|
|
file=$1
|
|
|
|
tasklist=$2
|
2008-12-05 13:12:10 -01:00
|
|
|
tasksel=$3
|
2006-12-29 05:05:30 -01:00
|
|
|
|
2008-06-07 17:03:44 +00:00
|
|
|
(grep -Ev "^(#.*)?[[:space:]]*$" $tasklist ;
|
|
|
|
echo DONE ;
|
2008-12-05 13:12:10 -01:00
|
|
|
cat $tasksel/usr/share/tasksel/debian-tasks.desc) | mawk '
|
2008-06-07 17:03:44 +00:00
|
|
|
|
|
|
|
/DONE/ {
|
|
|
|
in_tasks = 1
|
|
|
|
next
|
|
|
|
}
|
|
|
|
/^ / {
|
|
|
|
if (in_key) {
|
|
|
|
printf("%d:%s\n", tasklist[cur_task], $1)
|
|
|
|
next
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/.*/ {
|
|
|
|
if (!in_tasks) {
|
|
|
|
tasklist[$1] = num_tasks
|
|
|
|
num_tasks++
|
|
|
|
}
|
|
|
|
if (in_key) {
|
|
|
|
in_key = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^Task: / {
|
|
|
|
if (in_tasks) {
|
|
|
|
cur_task = $2
|
|
|
|
next
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/^Key: / {
|
|
|
|
if (in_tasks) {
|
|
|
|
for (taskname in tasklist) {
|
|
|
|
if (taskname == cur_task) {
|
2008-12-05 13:12:10 -01:00
|
|
|
in_key = 1
|
2008-06-07 17:03:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
next
|
2008-11-13 22:19:30 -01:00
|
|
|
}' | sort -s -n -k1 | cut -d: -f2 > $file
|
2006-12-29 05:05:30 -01:00
|
|
|
}
|
|
|
|
|
2008-06-07 00:02:36 +00:00
|
|
|
# We need to gunzip a copy of the appropriate Packages.gz file
|
|
|
|
# Assume i386, use the $CODENAME main Packages file
|
2008-10-12 23:54:01 +00:00
|
|
|
TMP_PKG=$TDIR/Packages
|
2008-06-07 00:02:36 +00:00
|
|
|
zcat $MIRROR/dists/$CODENAME/main/binary-i386/Packages.gz > $TMP_PKG
|
|
|
|
|
|
|
|
# Now grab the appropriate tasksel package
|
2008-06-07 19:03:45 +00:00
|
|
|
TASKSEL_DEB=$MIRROR/`mawk '
|
2008-06-07 00:02:36 +00:00
|
|
|
/^Package: tasksel-data$/ { found=1 }
|
|
|
|
/^Filename:/ { if (found==1) { print $2; exit } }' $TMP_PKG`
|
|
|
|
|
2008-10-12 23:54:01 +00:00
|
|
|
dpkg -x $TASKSEL_DEB $TDIR/tasksel
|
2008-06-07 00:02:36 +00:00
|
|
|
|
2008-12-05 13:12:10 -01:00
|
|
|
[ -e task.languages ] || exit 1
|
|
|
|
grep -Ev "^(#.*)?[[:space:]]*$" task.languages > $TDIR/languages
|
|
|
|
|
|
|
|
for variant in "" kde xfce; do
|
|
|
|
if [ ! -e task.list${variant:+.$variant} ]; then
|
|
|
|
echo "Warning: task.list${variant:+.$variant} does not exist; skipping"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
expand_task_list \
|
|
|
|
task.list${variant:+.$variant} \
|
|
|
|
$TDIR/languages
|
|
|
|
|
|
|
|
update_essential_list \
|
|
|
|
task-essential${variant:+-$variant} \
|
|
|
|
task.list${variant:+.$variant}.essential \
|
|
|
|
$TDIR/tasksel
|
|
|
|
|
|
|
|
update_full_list \
|
|
|
|
task-full${variant:+-$variant} \
|
|
|
|
task.list${variant:+.$variant}.full \
|
|
|
|
$TMP_PKG
|
|
|
|
done
|
2006-12-29 05:05:30 -01:00
|
|
|
|
2008-11-13 22:19:30 -01:00
|
|
|
rm -rf $TDIR
|