2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # T2 SDE: misc/archive/catedit.sh
6 # Copyright (C) 2004 - 2005 The T2 SDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 # WARNING: Create backup copies of your files before you use this tool
17 # for editing the categories of your packages !!!
19 # Usage: sh misc/archive/catedit.sh package/base/*/*.desc
20 # or: sh misc/archive/catedit.sh -a
28 if [ $
(dialog
--version 2>&1|
grep -c "0.9") -eq 0 ]; then
29 echo "dialog's version at least 0.9 needed"
33 if [ "$1" = "-a" -o "$1" = "--all" ]
34 then files
="$(find package/ -name *.desc | sort -t '/' -k 4)"
39 pkglst
=$
(grep '^\[C\]' $files |
sed -e 's,^[^:]*/,,;' \
40 -e 's,\.[^ ]* , ",;' -e 's,$,",;' |
sed -e 's, "$,",' \
43 eval dialog
--backtitle \"ROCK Linux package category editor
\" \
44 ${item:+--default-item} $item --cancel-label \
45 Quit
--menu \"Choose the package you want to edit
\" \
46 42 120 35 $pkglst 2> $tmp
52 for file in $files; do
53 [[ $file = */$item.desc
]] && break
56 (for category
in $
(awk '/^[^# ]/ {print $1}' < Documentation
/Developers
/PKG-CATEGORIES
); do
57 echo -n $category $category
58 if [ -n "$(grep "^\
[C\
].
*$category" $file )" ]
64 dialog
--cancel-label Back
--backtitle " categories for $item " \
65 --checklist "$(grep '^\[I\]' $file | sed 's/\[I\] //' )" \
66 42 80 35 $
(cat $tmp) 2> $tmp
67 value
=$
( cat $tmp |
sed -e 's/"//g' -e 's/ $//' )
69 if [ "$value" ] ; then
70 cat $file |
sed "s,^\[C\] .*,\[C\] $value,g" > $tmp
72 #grep -v '^\[C\]' "$file" > $tmp
73 #echo -e '\n'"[C] $value" >> $tmp
74 #./scripts/Create-DescPatch $item | patch -p1