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