source: freewrt/scripts/split-cfg.sh@ 145c3b8

Last change on this file since 145c3b8 was b9492d5, checked in by Phil Sutter <n0-1@…>, 19 years ago

merged from branches/common-adk 1310:1685

the following packages are not converted yet:

  • alsa
  • asterisk
  • pmacct
  • zaptel
  • elinks
  • libgd
  • lua
  • mypackage
  • openser
  • php*
  • snort*
  • tmsnc

additionally, freeradius doesn't compile.

happy fixing :P

git-svn-id: svn://www.freewrt.org/trunk/freewrt@1686 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 2.1 KB
Line 
1# $FreeWRT$
2#-
3# This file is part of the FreeWRT project. FreeWRT is copyrighted
4# material, please see the LICENCE file in the top-level directory
5# or at http://www.freewrt.org/licence for details.
6#-
7# Note: this is slow, but it's not the "progress stuff" which cau-
8# ses the slow-down.
9
10TOPDIR=$1
11
12shopt -s extglob
13
14mkdir -p $TOPDIR/.cfg
15cd $TOPDIR/.cfg
16
17oldfiles=$(echo *)
18newfiles=:
19
20echo -n 'autosplitting main config...'
21while read line; do
22 oline=$line
23 [[ -n $line ]] && if [[ $line = @(# [A-Z])* ]]; then
24 line=${line#? }
25 if [[ $line = *@( is not set) ]]; then
26 line=${line% is not set}
27 else
28 # some kind of comment
29 line=
30 fi
31 elif [[ $line = @([A-Z])*@(=)* ]]; then
32 line=${line%%=*}
33 elif [[ $line = @(#)* ]]; then
34 # valid comment
35 line=
36 else
37 # invalid non-comment
38 echo "Warning: line '$oline' invalid!" >&2
39 line=
40 fi
41 # if the line is a valid yes/no/whatever, write it
42 # unless the file already exists and has same content
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
56done <$TOPDIR/.config
57
58# now handle the case of removals
59echo -n ' removals...'
60for oldfile in $oldfiles; do
61 [[ $newfiles = *:$oldfile:* ]] || rm -f $oldfile
62done
63printf '\033[M\r'
64
65# now scan for dependencies of packages; the information
66# should probably be in build_mipsel because it's generated
67# at build time, but OTOH, soon enough, parts of Makefile
68# and the entire Config.in will be auto-generated anyway,
69# so we're better off placing it here
70#XXX this is too slow @868 configure options
71cd $TOPDIR/.cfg
72rm -f $TOPDIR/package/*/info.mk
73for option in *; do
74 echo -n "$option ..."
75 fgrep -l $option $TOPDIR/package/*/{Makefile,Config.in} 2>&- | \
76 while read line; do
77 echo ${line%/*}/info.mk
78 done | sort -u | while read fname; do
79 echo "\${_IPKGS_COOKIE}: \${TOPDIR}/.cfg/$option" >>$fname
80 done
81 printf '\033[M\r'
82done
83
84exit 0
Note: See TracBrowser for help on using the repository browser.