|
Revision 2953, 2.2 kB
(checked in by tg, 1 year ago)
|
• scan Config.* not just Config.in, because wbx doesn't believe
in keeping things simple and in one place (KISS)
• fix perms *sigh* if I get the person who commits these files
as executables…
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
TOPDIR=$1 |
|---|
| 11 |
|
|---|
| 12 |
[[ -n $BASH_VERSION ]] && shopt -s extglob |
|---|
| 13 |
|
|---|
| 14 |
mkdir -p $TOPDIR/.cfg |
|---|
| 15 |
cd $TOPDIR/.cfg |
|---|
| 16 |
|
|---|
| 17 |
oldfiles=$(echo *) |
|---|
| 18 |
newfiles=: |
|---|
| 19 |
|
|---|
| 20 |
echo -n 'autosplitting main config...' |
|---|
| 21 |
while read line; do |
|---|
| 22 |
oline=$line |
|---|
| 23 |
[[ -n $line ]] && if [[ $line = @( |
|---|
| 24 |
line=${line |
|---|
| 25 |
if [[ $line = *@( is not set) ]]; then |
|---|
| 26 |
line=${line% is not set} |
|---|
| 27 |
else |
|---|
| 28 |
|
|---|
| 29 |
line= |
|---|
| 30 |
fi |
|---|
| 31 |
elif [[ $line = @([A-Z])*@(=)* ]]; then |
|---|
| 32 |
line=${line%%=*} |
|---|
| 33 |
elif [[ $line = @( |
|---|
| 34 |
|
|---|
| 35 |
line= |
|---|
| 36 |
else |
|---|
| 37 |
|
|---|
| 38 |
echo "Warning: line '$oline' invalid!" >&2 |
|---|
| 39 |
line= |
|---|
| 40 |
fi |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
if [[ -n $line ]]; then |
|---|
| 44 |
if [[ $line != FWRT_HAVE_DOT_CONFIG && -s $line ]]; then |
|---|
| 45 |
fline=$(<$line) |
|---|
| 46 |
else |
|---|
| 47 |
fline= |
|---|
| 48 |
fi |
|---|
| 49 |
[[ $oline = $fline ]] || echo "$oline" >$line |
|---|
| 50 |
if [[ $newfiles = *:$line:* ]]; then |
|---|
| 51 |
echo "Error: duplicate Config.in option '$line'!" >&2 |
|---|
| 52 |
exit 1 |
|---|
| 53 |
fi |
|---|
| 54 |
newfiles=$newfiles$line: |
|---|
| 55 |
fi |
|---|
| 56 |
done <$TOPDIR/.config |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
echo -n ' removals...' |
|---|
| 60 |
for oldfile in $oldfiles; do |
|---|
| 61 |
[[ $newfiles = *:$oldfile:* ]] || rm -f $oldfile |
|---|
| 62 |
done |
|---|
| 63 |
printf '\r%60s\r' '' |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
cd $TOPDIR/.cfg |
|---|
| 72 |
rm -f $TOPDIR/package/*/info.mk |
|---|
| 73 |
for option in *; do |
|---|
| 74 |
echo -n "$option ..." |
|---|
| 75 |
x=$(( ${ |
|---|
| 76 |
ao=: |
|---|
| 77 |
fgrep -l $option $TOPDIR/package/*/{Makefile,Config.*} 2>&- | \ |
|---|
| 78 |
while read line; do |
|---|
| 79 |
echo ${line%/*}/info.mk |
|---|
| 80 |
done | while read fname; do |
|---|
| 81 |
[[ $ao = *:$fname:* ]] && continue |
|---|
| 82 |
ao=$ao$fname: |
|---|
| 83 |
echo "\${_IPKGS_COOKIE}: \${TOPDIR}/.cfg/$option" >>$fname |
|---|
| 84 |
done |
|---|
| 85 |
printf '\r%'$x's\r' '' |
|---|
| 86 |
done |
|---|
| 87 |
|
|---|
| 88 |
exit 0 |
|---|