-rwxr-xr-x | scripts/GeneratePackageMake | 8 | ||||
-rwxr-xr-x | scripts/mkipkg | 10 | ||||
-rwxr-xr-x | scripts/tothreaded | 4 |
3 files changed, 13 insertions, 9 deletions
diff --git a/scripts/GeneratePackageMake b/scripts/GeneratePackageMake index 099d3e8..9d692a9 100755 --- a/scripts/GeneratePackageMake +++ b/scripts/GeneratePackageMake | |||
@@ -1,228 +1,228 @@ | |||
1 | # generate file containg control name / package name / files | 1 | # generate file containg control name / package name / files |
2 | find . -name *.control | grep -v -- "-mt.control" | while read i | 2 | find . -name *.control | grep -v -- "-mt.control" | while read i |
3 | do | 3 | do |
4 | i=${i/.\//} | 4 | i=${i/.\//} |
5 | CDIR=${i%/*} | 5 | CDIR=${i%/*} |
6 | BNAME=${i##*/} | 6 | BNAME=${i##*/} |
7 | BNAME=${BNAME/.control/} | 7 | BNAME=${BNAME/.control/} |
8 | echo "cdir: ${CDIR}" | 8 | echo "cdir: ${CDIR}" |
9 | echo "bname: ${BNAME}" | 9 | echo "bname: ${BNAME}" |
10 | grep -e "Package:" -e "Files:" ./${i} | 10 | grep -e "Package:" -e "Files:" ./${i} |
11 | done > /tmp/ALL | 11 | done > /tmp/ALL |
12 | 12 | ||
13 | # | 13 | # |
14 | # makefile header | 14 | # makefile header |
15 | # | 15 | # |
16 | 16 | ||
17 | cat << MAKEFILEHEADER | 17 | cat << MAKEFILEHEADER |
18 | 18 | ||
19 | # | 19 | # |
20 | # generate -mt.control file from regular control | 20 | # generate -mt.control file from regular control |
21 | # arg 1 : path to control file to convert | 21 | # arg 1 : path to control file to convert |
22 | # | 22 | # |
23 | 23 | ||
24 | define GenerateMTControl | 24 | define GenerateMTControl |
25 | @echo "Generating -mt control file for \$(basename \$<)" | 25 | @echo "Generating -mt control file for \$(basename \$<)" |
26 | @\$(OPIEDIR)/scripts/tothreaded \$< \$(OPIEDIR)/AllThreadedPackages | 26 | @\$(OPIEDIR)/scripts/tothreaded \$< \$(OPIEDIR)/AllThreadedPackages |
27 | endef | 27 | endef |
28 | 28 | ||
29 | # | 29 | # |
30 | # package one control file | 30 | # package one control file |
31 | # arg 1 : directory from OPIEROOT where control file resides | 31 | # arg 1 : directory from OPIEROOT where control file resides |
32 | # arg 2 : control file basename without -mt (no .control) | 32 | # arg 2 : control file basename without -mt (no .control) |
33 | # arg 3 : control file basename with -mt if needed | 33 | # arg 3 : control file basename with -mt if needed |
34 | # arg 4 : package name (value specified by Package: ...) | 34 | # arg 4 : package name (value specified by Package: ...) |
35 | # | 35 | # |
36 | 36 | ||
37 | define DoPackage | 37 | define DoPackage |
38 | @echo \"Building ipk of \$(4)\" | 38 | echo \"Building ipk of \$(4)\" |
39 | @( \$(ForSubst) ) > \$(TOPDIR)/scripts/subst | 39 | ( \$(ForSubst) ) > \$(TOPDIR)/scripts/subst |
40 | @( \$(ForFileSubst) ) > \$(TOPDIR)/scripts/Filesubst | 40 | ( \$(ForFileSubst) ) > \$(TOPDIR)/scripts/Filesubst |
41 | @( cd \$(OPIEDIR); \\ | 41 | ( cd \$(OPIEDIR); \\ |
42 | \$(OPIEDIR)/scripts/mkipkg \\ | 42 | \$(OPIEDIR)/scripts/mkipkg \\ |
43 | --subst=\$(OPIEDIR)/scripts/subst \\ | 43 | --subst=\$(OPIEDIR)/scripts/subst \\ |
44 | --filesubst=\$(OPIEDIR)/scripts/filesubst \\ | 44 | --filesubst=\$(OPIEDIR)/scripts/filesubst \\ |
45 | --control=\$(OPIEDIR)/\$(1)/\$(3).control \\ | 45 | --control=\$(OPIEDIR)/\$(1)/\$(3).control \\ |
46 | --prerm=\$(OPIEDIR)/\$(1)/\$(2).prerm \\ | 46 | --prerm=\$(OPIEDIR)/\$(1)/\$(2).prerm \\ |
47 | --preinst=\$(OPIEDIR)/\$(1)/\$(2).preinst \\ | 47 | --preinst=\$(OPIEDIR)/\$(1)/\$(2).preinst \\ |
48 | --postrm=\$(OPIEDIR)/\$(1)/\$(2).postrm \\ | 48 | --postrm=\$(OPIEDIR)/\$(1)/\$(2).postrm \\ |
49 | --postinst=\$(OPIEDIR)/\$(1)/\$(2).postinst \\ | 49 | --postinst=\$(OPIEDIR)/\$(1)/\$(2).postinst \\ |
50 | --strip=\$(STRIP) \$(OPIEDIR); \\ | 50 | --strip=\$(STRIP) \$(OPIEDIR); \\ |
51 | rm -f \$(OPIEDIR)/Packages/\$(4)_*.ipk; \\ | 51 | rm -f \$(OPIEDIR)/Packages/\$(4)_*.ipk; \\ |
52 | mv *.ipk \$(OPIEDIR)/Packages; \\ | 52 | mv *.ipk \$(OPIEDIR)/Packages; \\ |
53 | touch \$(OPIEDIR)/Packages/\$(4) \\ | 53 | touch \$(OPIEDIR)/Packages/\$(4) \\ |
54 | ) || true | 54 | ) || true |
55 | endef | 55 | endef |
56 | 56 | ||
57 | # | 57 | # |
58 | # prepared for generating the substfile for every build | 58 | # prepared for generating the substfile for every build |
59 | # | 59 | # |
60 | 60 | ||
61 | define ForSubst | 61 | define ForSubst |
62 | echo 's,\\\$\$QPE_VERSION,\$(QPE_VERSION),g'; \\ | 62 | echo 's,\\\$\$QPE_VERSION,\$(QPE_VERSION),g'; \\ |
63 | echo 's,\\\$\$OPIE_VERSION,\$(OPIE_VERSION),g'; \\ | 63 | echo 's,\\\$\$OPIE_VERSION,\$(OPIE_VERSION),g'; \\ |
64 | echo 's,\\\$\$QTE_VERSION,\$(QTE_VERSION),g'; \\ | 64 | echo 's,\\\$\$QTE_VERSION,\$(QTE_VERSION),g'; \\ |
65 | echo 's,\\\$\$QTE_REVISION,\$(QTE_REVISION),g'; \\ | 65 | echo 's,\\\$\$QTE_REVISION,\$(QTE_REVISION),g'; \\ |
66 | echo 's,\\\$\$SUB_VERSION,\$(SUB_VERSION),g'; \\ | 66 | echo 's,\\\$\$SUB_VERSION,\$(SUB_VERSION),g'; \\ |
67 | echo 's,\\\$\$EXTRAVERSION,\$(EXTRAVERSION),g'; \\ | 67 | echo 's,\\\$\$EXTRAVERSION,\$(EXTRAVERSION),g'; \\ |
68 | echo 's,\\\$\$QTE_BASEVERSION,\$(QTE_BASEVERSION),g' | 68 | echo 's,\\\$\$QTE_BASEVERSION,\$(QTE_BASEVERSION),g' |
69 | endef | 69 | endef |
70 | 70 | ||
71 | define ForFileSubst | 71 | define ForFileSubst |
72 | echo 's,\\\$\$OPIEDIR/root/,/,g'; \\ | 72 | echo 's,\\\$\$OPIEDIR/root/,/,g'; \\ |
73 | echo 's,\$(OPIEDIR)/root/,/,g'; \\ | 73 | echo 's,\$(OPIEDIR)/root/,/,g'; \\ |
74 | echo 's,\\\$\$OPIEDIR,\$(prefix),g'; \\ | 74 | echo 's,\\\$\$OPIEDIR,\$(prefix),g'; \\ |
75 | echo 's,\$(OPIEDIR),\$(prefix),g'; \\ | 75 | echo 's,\$(OPIEDIR),\$(prefix),g'; \\ |
76 | echo 's,\\\$\$QTDIR,\$(prefix),g'; \\ | 76 | echo 's,\\\$\$QTDIR,\$(prefix),g'; \\ |
77 | echo 's,\$(QTDIR),\$(prefix),g'; \\ | 77 | echo 's,\$(QTDIR),\$(prefix),g'; \\ |
78 | echo 's,^\(\./\)*root/,/,g'; \\ | 78 | echo 's,^\(\./\)*root/,/,g'; \\ |
79 | echo 's,^\(\./\)*etc/,\$(prefix)/etc/,g'; \\ | 79 | echo 's,^\(\./\)*etc/,\$(prefix)/etc/,g'; \\ |
80 | echo 's,^\(\./\)*lib/,\$(prefix)/lib/,g'; \\ | 80 | echo 's,^\(\./\)*lib/,\$(prefix)/lib/,g'; \\ |
81 | echo 's,^\(\./\)*bin/,\$(prefix)/bin/,g'; \\ | 81 | echo 's,^\(\./\)*bin/,\$(prefix)/bin/,g'; \\ |
82 | echo 's,^\(\./\)*pics/,\$(prefix)/pics/,g'; \\ | 82 | echo 's,^\(\./\)*pics/,\$(prefix)/pics/,g'; \\ |
83 | echo 's,^\(\./\)*sounds/,\$(prefix)/sounds/,g'; \\ | 83 | echo 's,^\(\./\)*sounds/,\$(prefix)/sounds/,g'; \\ |
84 | echo 's,^\(\./\)*i18n/,\$(prefix)/i18n/,g'; \\ | 84 | echo 's,^\(\./\)*i18n/,\$(prefix)/i18n/,g'; \\ |
85 | echo 's,^\(\./\)*plugins/,\$(prefix)/plugins/,g'; \\ | 85 | echo 's,^\(\./\)*plugins/,\$(prefix)/plugins/,g'; \\ |
86 | echo 's,^\(\./\)*apps/,\$(prefix)/apps/,g'; \\ | 86 | echo 's,^\(\./\)*apps/,\$(prefix)/apps/,g'; \\ |
87 | echo 's,^\(\./\)*share/,\$(prefix)/share/,g'; \\ | 87 | echo 's,^\(\./\)*share/,\$(prefix)/share/,g'; \\ |
88 | echo 's,^\(\./\)*i18n/,\$(prefix)/i18n/,g'; \\ | 88 | echo 's,^\(\./\)*i18n/,\$(prefix)/i18n/,g'; \\ |
89 | echo 's,^\(\./\)*help/,\$(prefix)/help/,g' | 89 | echo 's,^\(\./\)*help/,\$(prefix)/help/,g' |
90 | endef | 90 | endef |
91 | 91 | ||
92 | # | 92 | # |
93 | # Will contain a list of all non-mt control files | 93 | # Will contain a list of all non-mt control files |
94 | ALLCONTROLFILES= | 94 | ALLCONTROLFILES= |
95 | 95 | ||
96 | # | 96 | # |
97 | # Will contain a list of all packaging targets | 97 | # Will contain a list of all packaging targets |
98 | ALLPACKAGES= | 98 | ALLPACKAGES= |
99 | 99 | ||
100 | # s contains now single space | 100 | # s contains now single space |
101 | s=\$(x) \$(x) | 101 | s=\$(x) \$(x) |
102 | 102 | ||
103 | # | 103 | # |
104 | # for convenience : generate AllTh | 104 | # for convenience : generate AllTh |
105 | ATP=\$(OPIEDIR)/AllThreadedPackages | 105 | ATP=\$(OPIEDIR)/AllThreadedPackages |
106 | 106 | ||
107 | MAKEFILEHEADER | 107 | MAKEFILEHEADER |
108 | 108 | ||
109 | while read k | 109 | while read k |
110 | do | 110 | do |
111 | CDIR="${k#* }" | 111 | CDIR="${k#* }" |
112 | read k | 112 | read k |
113 | BNAME="${k#* }" | 113 | BNAME="${k#* }" |
114 | read k | 114 | read k |
115 | case $k in | 115 | case $k in |
116 | *"ackage:"*) | 116 | *"ackage:"*) |
117 | Pkg="${k#* }" | 117 | Pkg="${k#* }" |
118 | Pkg="${Pkg// }" | 118 | Pkg="${Pkg// }" |
119 | ;; | 119 | ;; |
120 | *"iles:"*) | 120 | *"iles:"*) |
121 | Files="${k/Files:/}" | 121 | Files="${k/Files:/}" |
122 | ;; | 122 | ;; |
123 | esac | 123 | esac |
124 | read k | 124 | read k |
125 | case $k in | 125 | case $k in |
126 | *"ackage:"*) | 126 | *"ackage:"*) |
127 | Pkg="${k#* }" | 127 | Pkg="${k#* }" |
128 | Pkg="${Pkg// }" | 128 | Pkg="${Pkg// }" |
129 | ;; | 129 | ;; |
130 | *"iles:"*) | 130 | *"iles:"*) |
131 | Files="${k/Files:/}" | 131 | Files="${k/Files:/}" |
132 | ;; | 132 | ;; |
133 | esac | 133 | esac |
134 | 134 | ||
135 | cat << HERE | 135 | cat << HERE |
136 | # | 136 | # |
137 | # package $Pkg in ${BNAME} | 137 | # package $Pkg in ${BNAME} |
138 | # | 138 | # |
139 | 139 | ||
140 | package-${Pkg} : \$(OPIEDIR)/Packages/$Pkg | 140 | package-${Pkg} : \$(OPIEDIR)/Packages/$Pkg |
141 | package-${Pkg}-mt : \$(ATP) \$(OPIEDIR)/Packages/$Pkg-mt | 141 | package-${Pkg}-mt : \$(ATP) \$(OPIEDIR)/Packages/$Pkg-mt |
142 | 142 | ||
143 | # collect control files and package targets | 143 | # collect control files and package targets |
144 | 144 | ||
145 | ALLCONTROLFILES += ${CDIR}/${BNAME}.control | 145 | ALLCONTROLFILES += ${CDIR}/${BNAME}.control |
146 | ALLPACKAGES += $Pkg | 146 | ALLPACKAGES += $Pkg |
147 | 147 | ||
148 | # to generate -mt control file | 148 | # to generate -mt control file |
149 | \$(OPIEDIR)/${CDIR}/${BNAME}-mt.control : \$(OPIEDIR)/${CDIR}/${BNAME}.control | 149 | \$(OPIEDIR)/${CDIR}/${BNAME}-mt.control : \$(OPIEDIR)/${CDIR}/${BNAME}.control |
150 | \$(GenerateMTControl) | 150 | \$(GenerateMTControl) |
151 | 151 | ||
152 | HERE | 152 | HERE |
153 | 153 | ||
154 | if [ ! -z "${Files}" ] | 154 | if [ ! -z "${Files}" ] |
155 | then | 155 | then |
156 | 156 | ||
157 | cat << HERE | 157 | cat << HERE |
158 | # optimize speed | 158 | # optimize speed |
159 | .phony : \$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) | 159 | .phony : \$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) |
160 | 160 | ||
161 | # capture missing files (because not built) | 161 | # capture missing files (because not built) |
162 | \$(OPIEDIR)/Packages/$Pkg \$(OPIEDIR)/Packages/$Pkg-mt \$(SUBSTFILES): \$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) | 162 | \$(OPIEDIR)/Packages/$Pkg \$(OPIEDIR)/Packages/$Pkg-mt \$(SUBSTFILES): \$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) |
163 | HERE | 163 | HERE |
164 | 164 | ||
165 | # echo "\$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) : " | 165 | # echo "\$(wildcard \$(addprefix \$(OPIEDIR)/,${Files})) : " |
166 | 166 | ||
167 | fi | 167 | fi |
168 | 168 | ||
169 | cat << HERE | 169 | cat << HERE |
170 | \$(OPIEDIR)/Packages/$Pkg : \$(OPIEDIR)/${CDIR}/${BNAME}.control | 170 | \$(OPIEDIR)/Packages/$Pkg : \$(OPIEDIR)/${CDIR}/${BNAME}.control |
171 | @\$(call DoPackage,${CDIR},${BNAME},${BNAME},${Pkg}) | 171 | @\$(call DoPackage,${CDIR},${BNAME},${BNAME},${Pkg}) |
172 | \$(OPIEDIR)/Packages/$Pkg-mt : \$(OPIEDIR)/${CDIR}/${BNAME}-mt.control | 172 | \$(OPIEDIR)/Packages/$Pkg-mt : \$(OPIEDIR)/${CDIR}/${BNAME}-mt.control |
173 | @\$(call DoPackage,${CDIR},${BNAME},${BNAME}-mt,${Pkg}-mt) | 173 | @\$(call DoPackage,${CDIR},${BNAME},${BNAME}-mt,${Pkg}-mt) |
174 | 174 | ||
175 | HERE | 175 | HERE |
176 | 176 | ||
177 | done < /tmp/ALL | 177 | done < /tmp/ALL |
178 | 178 | ||
179 | cat << HERE | 179 | cat << HERE |
180 | # | 180 | # |
181 | # regenerate package file if control files are modified | 181 | # regenerate package file if control files are modified |
182 | # | 182 | # |
183 | 183 | ||
184 | Package.make : \$(addprefix \$(OPIEDIR)/,\$(ALLCONTROLFILES)) | 184 | Package.make : \$(addprefix \$(OPIEDIR)/,\$(ALLCONTROLFILES)) |
185 | 185 | ||
186 | # | 186 | # |
187 | # make targets to build packages | 187 | # make targets to build packages |
188 | # needs quicklauncher link in location (because dangling | 188 | # needs quicklauncher link in location (because dangling |
189 | # links are not considered as true files by the wildcard command) | 189 | # links are not considered as true files by the wildcard command) |
190 | # | 190 | # |
191 | # if you want to build one package only then use | 191 | # if you want to build one package only then use |
192 | # make package-<basenameof control> | 192 | # make package-<basenameof control> |
193 | # or make package-<basenameof control>-mt | 193 | # or make package-<basenameof control>-mt |
194 | # | 194 | # |
195 | 195 | ||
196 | packages : /opt/QtPalmtop/bin/quicklauncher \\ | 196 | packages : /opt/QtPalmtop/bin/quicklauncher \\ |
197 | \$(OPIEDIR)/Packages \\ | 197 | \$(OPIEDIR)/Packages \\ |
198 | \$(add prefix \$(OPIEDIR)/Packages/,\$(ALLPACKAGES)) | 198 | \$(add prefix \$(OPIEDIR)/Packages/,\$(ALLPACKAGES)) |
199 | packages-mt : /opt/QtPalmtop/bin/quicklauncher \\ | 199 | packages-mt : /opt/QtPalmtop/bin/quicklauncher \\ |
200 | \$(ATP) \\ | 200 | \$(ATP) \\ |
201 | \$(OPIEDIR)/Packages \\ | 201 | \$(OPIEDIR)/Packages \\ |
202 | \$(addprefix \$(OPIEDIR)/Packages/,\$(addsuffix -mt,\$(ALLPACKAGES))) | 202 | \$(addprefix \$(OPIEDIR)/Packages/,\$(addsuffix -mt,\$(ALLPACKAGES))) |
203 | 203 | ||
204 | # | 204 | # |
205 | # capture missing quichlauncher link | 205 | # capture missing quichlauncher link |
206 | # | 206 | # |
207 | 207 | ||
208 | /opt/QtPalmtop/bin/quicklauncher : | 208 | /opt/QtPalmtop/bin/quicklauncher : |
209 | @echo "create a link from /opt/QtPalmtop to \$(OPIEDIR) for this target to work" | 209 | @echo "create a link from /opt/QtPalmtop to \$(OPIEDIR) for this target to work" |
210 | exit 2 | 210 | exit 2 |
211 | 211 | ||
212 | # | 212 | # |
213 | # Create Packages directory | 213 | # Create Packages directory |
214 | # | 214 | # |
215 | 215 | ||
216 | \$(OPIEDIR)/Packages : | 216 | \$(OPIEDIR)/Packages : |
217 | @mkdir \$(OPIEDIR)/Packages | 217 | @mkdir \$(OPIEDIR)/Packages |
218 | 218 | ||
219 | # | 219 | # |
220 | # update file containing all packages | 220 | # update file containing all packages |
221 | # | 221 | # |
222 | 222 | ||
223 | \$(ATP) : \$(addprefix \$(OPIEDIR)/,\$(ALLCONTROLFILES)) | 223 | \$(ATP) : \$(addprefix \$(OPIEDIR)/,\$(ALLCONTROLFILES)) |
224 | @echo "Generating \$(notdir \$(ATP))" | 224 | @echo "Generating \$(notdir \$(ATP))" |
225 | @echo -e "\$(subst \$(s),,\$(foreach i,\$(ALLPACKAGES),\$(i)\n))" > \$@ | 225 | @echo -e "\$(subst \$(s),,\$(foreach i,\$(ALLPACKAGES),\$(i)\n))" > \$@ |
226 | HERE | 226 | HERE |
227 | 227 | ||
228 | rm /tmp/ALL | 228 | rm /tmp/ALL |
diff --git a/scripts/mkipkg b/scripts/mkipkg index a336371..2f020f4 100755 --- a/scripts/mkipkg +++ b/scripts/mkipkg | |||
@@ -1,388 +1,392 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # vim: et sw=4 | 2 | # vim: et sw=4 |
3 | 3 | ||
4 | # TODO: srcdir!=builddir | 4 | # TODO: srcdir!=builddir |
5 | 5 | ||
6 | usage() | 6 | usage() |
7 | { | 7 | { |
8 | echo "usage: $self --destdir=[destination installation directory]" | 8 | echo "usage: $self --destdir=[destination installation directory]" |
9 | echo "usage: $self [destination installation directory]" | 9 | echo "usage: $self [destination installation directory]" |
10 | exit 1 | 10 | exit 1 |
11 | } | 11 | } |
12 | 12 | ||
13 | self=mkipkg | 13 | self=mkipkg |
14 | destdir= | 14 | destdir= |
15 | strip=strip | 15 | strip=strip |
16 | control= | 16 | control= |
17 | builddir= | 17 | builddir= |
18 | srcdir= | 18 | srcdir= |
19 | prefix= | 19 | prefix= |
20 | preinst= | 20 | preinst= |
21 | postinst= | 21 | postinst= |
22 | prerm= | 22 | prerm= |
23 | postrm= | 23 | postrm= |
24 | mkfsjffs2= | 24 | mkfsjffs2= |
25 | ipkgbuild=ipkg-build | 25 | ipkgbuild=ipkg-build |
26 | buildversion= | 26 | buildversion= |
27 | subst= | 27 | subst= |
28 | user=root | 28 | user=root |
29 | group=root | 29 | group=root |
30 | filesubst= | 30 | filesubst= |
31 | 31 | ||
32 | oldpwd= | 32 | oldpwd= |
33 | 33 | ||
34 | for option | 34 | for option |
35 | do | 35 | do |
36 | case "$option" in | 36 | case "$option" in |
37 | -*=*) | 37 | -*=*) |
38 | arg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` | 38 | arg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` |
39 | ;; | 39 | ;; |
40 | esac | 40 | esac |
41 | 41 | ||
42 | case "$option" in | 42 | case "$option" in |
43 | --destdir=*) | 43 | --destdir=*) |
44 | destdir=$arg | 44 | destdir=$arg |
45 | ;; | 45 | ;; |
46 | --strip=*) | 46 | --strip=*) |
47 | strip=$arg | 47 | strip=$arg |
48 | ;; | 48 | ;; |
49 | --control=*) | 49 | --control=*) |
50 | control=$arg | 50 | control=$arg |
51 | ;; | 51 | ;; |
52 | --preinst=*) | 52 | --preinst=*) |
53 | preinst=$arg | 53 | preinst=$arg |
54 | ;; | 54 | ;; |
55 | --postinst=*) | 55 | --postinst=*) |
56 | postinst=$arg | 56 | postinst=$arg |
57 | ;; | 57 | ;; |
58 | --prerm=*) | 58 | --prerm=*) |
59 | prerm=$arg | 59 | prerm=$arg |
60 | ;; | 60 | ;; |
61 | --postrm=*) | 61 | --postrm=*) |
62 | postrm=$arg | 62 | postrm=$arg |
63 | ;; | 63 | ;; |
64 | --builddir=*) | 64 | --builddir=*) |
65 | builddir=$arg | 65 | builddir=$arg |
66 | ;; | 66 | ;; |
67 | --srcdir=*) | 67 | --srcdir=*) |
68 | srcdir=$arg | 68 | srcdir=$arg |
69 | ;; | 69 | ;; |
70 | --prefix=*) | 70 | --prefix=*) |
71 | prefix=$arg | 71 | prefix=$arg |
72 | ;; | 72 | ;; |
73 | --mkfsjffs2=*) | 73 | --mkfsjffs2=*) |
74 | mkfsjffs2=$arg | 74 | mkfsjffs2=$arg |
75 | ;; | 75 | ;; |
76 | --ipkgbuild=*) | 76 | --ipkgbuild=*) |
77 | ipkgbuild=$arg | 77 | ipkgbuild=$arg |
78 | ;; | 78 | ;; |
79 | --buildversion=*) | 79 | --buildversion=*) |
80 | buildversion=$arg | 80 | buildversion=$arg |
81 | ;; | 81 | ;; |
82 | --subst=*) | 82 | --subst=*) |
83 | subst=$arg | 83 | subst=$arg |
84 | ;; | 84 | ;; |
85 | --user=*) | 85 | --user=*) |
86 | user=$arg | 86 | user=$arg |
87 | ;; | 87 | ;; |
88 | --group=*) | 88 | --group=*) |
89 | group=$arg | 89 | group=$arg |
90 | ;; | 90 | ;; |
91 | --filesubst=*) | 91 | --filesubst=*) |
92 | filesubst=$arg | 92 | filesubst=$arg |
93 | ;; | 93 | ;; |
94 | --classic) | 94 | --classic) |
95 | classic=-c | 95 | classic=-c |
96 | ;; | 96 | ;; |
97 | -*) | 97 | -*) |
98 | usage | 98 | usage |
99 | ;; | 99 | ;; |
100 | *) | 100 | *) |
101 | destdir=$option | 101 | destdir=$option |
102 | ;; | 102 | ;; |
103 | esac | 103 | esac |
104 | done | 104 | done |
105 | 105 | ||
106 | if [ -z "$control" ]; then | 106 | if [ -z "$control" ]; then |
107 | control=$destdir/CONTROL/control | 107 | control=$destdir/CONTROL/control |
108 | fi | 108 | fi |
109 | if [ -z "$prerm" ]; then | 109 | if [ -z "$prerm" ]; then |
110 | prerm=$destdir/CONTROL/prerm | 110 | prerm=$destdir/CONTROL/prerm |
111 | fi | 111 | fi |
112 | if [ -z "$postrm" ]; then | 112 | if [ -z "$postrm" ]; then |
113 | postrm=$destdir/CONTROL/postrm | 113 | postrm=$destdir/CONTROL/postrm |
114 | fi | 114 | fi |
115 | if [ -z "$preinst" ]; then | 115 | if [ -z "$preinst" ]; then |
116 | preinst=$destdir/CONTROL/preinst | 116 | preinst=$destdir/CONTROL/preinst |
117 | fi | 117 | fi |
118 | if [ -z "$postinst" ]; then | 118 | if [ -z "$postinst" ]; then |
119 | postinst=$destdir/CONTROL/postinst | 119 | postinst=$destdir/CONTROL/postinst |
120 | fi | 120 | fi |
121 | 121 | ||
122 | # remove leading slash from prefix (to fix globbing) | 122 | # remove leading slash from prefix (to fix globbing) |
123 | if [ -n "$prefix" ]; then | 123 | if [ -n "$prefix" ]; then |
124 | prefix=`echo $prefix | sed -e "s,/\(.*\),\\1,"` | 124 | prefix=`echo $prefix | sed -e "s,/\(.*\),\\1,"` |
125 | fi | 125 | fi |
126 | 126 | ||
127 | if [ -z "$destdir" ]; then | 127 | if [ -z "$destdir" ]; then |
128 | usage | 128 | usage |
129 | fi | 129 | fi |
130 | 130 | ||
131 | if [ ! -r $control ]; then | 131 | if [ ! -r $control ]; then |
132 | echo "$self: cannot find $control, exiting..." | 132 | echo "$self: cannot find $control, exiting..." |
133 | exit 1 | 133 | exit 1 |
134 | fi | 134 | fi |
135 | 135 | ||
136 | if [ -z "`which $ipkgbuild 2>/dev/null`" ]; then | 136 | if [ -z "`which $ipkgbuild 2>/dev/null`" ]; then |
137 | echo "$self: cannot find ipkg-build, exiting..." | 137 | echo "$self: cannot find ipkg-build, exiting..." |
138 | exit 1 | 138 | exit 1 |
139 | fi | 139 | fi |
140 | 140 | ||
141 | findFile() | 141 | findFile() |
142 | { | 142 | { |
143 | local path= | 143 | local path= |
144 | if [ $# = 1 ]; then | 144 | if [ $# = 1 ]; then |
145 | find $1 -type f -o -type b -o -type c -o -type l | 145 | find $1 -type f -o -type b -o -type c -o -type l |
146 | find $1 -type d -a -empty | 146 | find $1 -type d -a -empty |
147 | else | 147 | else |
148 | find . -type f -o -type b -o -type c -o -type l | \ | 148 | find . -type f -o -type b -o -type c -o -type l | \ |
149 | sed -e "s,\./\(.*\),\\1,g" | 149 | sed -e "s,\./\(.*\),\\1,g" |
150 | find . -type d -a -empty | 150 | find . -type d -a -empty |
151 | fi | 151 | fi |
152 | } | 152 | } |
153 | 153 | ||
154 | _pushd() { oldpwd=`pwd`; cd $1; } | 154 | _pushd() { oldpwd=`pwd`; cd $1; } |
155 | _popd() { cd $oldpwd; } | 155 | _popd() { cd $oldpwd; } |
156 | 156 | ||
157 | setVar() | 157 | setVar() |
158 | { | 158 | { |
159 | eval "$1='$2'" | 159 | eval "$1='$2'" |
160 | } | 160 | } |
161 | 161 | ||
162 | expandMaskToList() | 162 | expandMaskToList() |
163 | { | 163 | { |
164 | local _list=`echo $1` | 164 | local _list=`echo $1` |
165 | local _tmpFileList= | 165 | local _tmpFileList= |
166 | for f in $_list; do | 166 | for f in $_list; do |
167 | if [ -d $f ]; then | 167 | if [ -d $f ]; then |
168 | f="`findFile $f`" | 168 | f="`findFile $f`" |
169 | fi | 169 | fi |
170 | _tmpFileList="`eval echo $f` $_tmpFileList" | 170 | _tmpFileList="`eval echo $f` $_tmpFileList" |
171 | done | 171 | done |
172 | setVar $2 "$_tmpFileList" | 172 | setVar $2 "$_tmpFileList" |
173 | } | 173 | } |
174 | 174 | ||
175 | createFileList() | 175 | createFileList() |
176 | { | 176 | { |
177 | local excludeMask | 177 | local excludeMask |
178 | local includeMask | 178 | local includeMask |
179 | local includemaskpresent=0 | 179 | local includemaskpresent=0 |
180 | local excludemaskpresent=0 | 180 | local excludemaskpresent=0 |
181 | 181 | ||
182 | if (grep -q ^FileExcludeMask $1); then | 182 | if (grep -q ^FileExcludeMask $1); then |
183 | excludemaskpresent=1 | 183 | excludemaskpresent=1 |
184 | excludeMask=$(eval echo '"'$(sed -n -e "s,^FileExcludeMask: *,,p" $1)'"') | 184 | excludeMask=$(eval echo '"'$(sed -n -e "s,^FileExcludeMask: *,,p" $1)'"') |
185 | fi | 185 | fi |
186 | if (grep -q ^FileIncludeMask $1); then | 186 | if (grep -q ^FileIncludeMask $1); then |
187 | includemaskpresent=1 | 187 | includemaskpresent=1 |
188 | includeMask=$(eval echo '"'$(sed -n -e "s,^FileIncludeMask: *,,p" $1)'"') | 188 | includeMask=$(eval echo '"'$(sed -n -e "s,^FileIncludeMask: *,,p" $1)'"') |
189 | else | 189 | else |
190 | if (grep -q ^Files: $1); then | 190 | if (grep -q ^Files: $1); then |
191 | includemaskpresent=1 | 191 | includemaskpresent=1 |
192 | includeMask=$(eval echo '"'$(sed -n -e "s,^Files: *,,p" $1)'"') | 192 | includeMask=$(eval echo '"'$(sed -n -e "s,^Files: *,,p" $1)'"') |
193 | fi | 193 | fi |
194 | fi | 194 | fi |
195 | 195 | ||
196 | _pushd $destdir | 196 | _pushd $destdir |
197 | 197 | ||
198 | declare -a excludeMaskArray | 198 | declare -a excludeMaskArray |
199 | excludeMaskArray=( $excludeMask ) | 199 | excludeMaskArray=( $excludeMask ) |
200 | excludeMaskArray=( "${excludeMaskArray[@]}" "CONTROL/*" "usr/share/*" ) | 200 | excludeMaskArray=( "${excludeMaskArray[@]}" "CONTROL/*" "usr/share/*" ) |
201 | 201 | ||
202 | if [ $includemaskpresent != 1 ]; then | 202 | if [ $includemaskpresent != 1 ]; then |
203 | includeMask="." | 203 | includeMask="." |
204 | fi | 204 | fi |
205 | 205 | ||
206 | if [ -z "$includeMask" ]; then | 206 | if [ -z "$includeMask" ]; then |
207 | setVar $2 "" | 207 | setVar $2 "" |
208 | _popd | 208 | _popd |
209 | return 0 | 209 | return 0 |
210 | fi | 210 | fi |
211 | 211 | ||
212 | expandMaskToList "$includeMask" _fileList | 212 | expandMaskToList "$includeMask" _fileList |
213 | 213 | ||
214 | excludeMaskArray=( "${excludeMaskArray[@]}" "*/CVS*" "*/SCCS*" ) | 214 | excludeMaskArray=( "${excludeMaskArray[@]}" "*/CVS*" "*/SCCS*" ) |
215 | 215 | ||
216 | local realFileList= | 216 | local realFileList= |
217 | local missing=0 | 217 | local missing=0 |
218 | for file in $_fileList; do | 218 | for file in $_fileList; do |
219 | local containedInList=0 | 219 | local containedInList=0 |
220 | for i in "${excludeMaskArray[@]}"; do | 220 | for i in "${excludeMaskArray[@]}"; do |
221 | if [[ $file == $i ]]; then | 221 | if [[ $file == $i ]]; then |
222 | containedInList=1 | 222 | containedInList=1 |
223 | break; | 223 | break; |
224 | fi | 224 | fi |
225 | done | 225 | done |
226 | 226 | ||
227 | if [ $containedInList = 0 ]; then | 227 | if [ $containedInList = 0 ]; then |
228 | if ! [ -e $file -o -L $file ]; then | 228 | if ! [ -e $file -o -L $file ]; then |
229 | echo "$self: $file not found" | 229 | echo "$self: $file not found" |
230 | missing=1 | 230 | missing=1 |
231 | fi | 231 | fi |
232 | realFileList=$file" $realFileList" | 232 | realFileList=$file" $realFileList" |
233 | fi | 233 | fi |
234 | done | 234 | done |
235 | 235 | ||
236 | _popd | 236 | _popd |
237 | 237 | ||
238 | if [ $missing = 1 ]; then | 238 | if [ $missing = 1 ]; then |
239 | return 1 | 239 | return 1 |
240 | fi | 240 | fi |
241 | 241 | ||
242 | setVar $2 "$realFileList" | 242 | setVar $2 "$realFileList" |
243 | } | 243 | } |
244 | 244 | ||
245 | stripFile() | 245 | stripFile() |
246 | { | 246 | { |
247 | if [ -f $1 -a -x $1 ]; then | 247 | if [ ! -h $1 -a -f $1 -a -x $1 ]; then |
248 | $strip --strip-all $1 | 248 | $strip -p --strip-all $1 |
249 | fi | 249 | fi |
250 | } | 250 | } |
251 | 251 | ||
252 | substFile() | 252 | substFile() |
253 | { | 253 | { |
254 | local oldfile=$1 | 254 | local oldfile=$1 |
255 | 255 | ||
256 | if [ ! -e $2 ]; then return 1; fi | 256 | if [ ! -e $2 ]; then return 1; fi |
257 | 257 | ||
258 | if [ -e $oldfile -o -L $oldfile ]; then | 258 | if [ -e $oldfile -o -L $oldfile ]; then |
259 | newfile=`echo $oldfile|sed -f $2|sed -e's,^/,,g'` | 259 | newfile=`echo $oldfile|sed -f $2|sed -e's,^/,,g'` |
260 | olddir=`dirname $oldfile` | 260 | olddir=`dirname $oldfile` |
261 | base=`basename $oldfile` | 261 | base=`basename $oldfile` |
262 | newdir=`dirname $newfile` | 262 | newdir=`dirname $newfile` |
263 | 263 | ||
264 | # echo >&2 moving $oldfile to $newfile | 264 | # echo >&2 moving $oldfile to $newfile |
265 | 265 | ||
266 | if [ "$newdir" = "$olddir" ]; then | 266 | if [ "$newdir" = "$olddir" ]; then |
267 | return 0 | 267 | return 0 |
268 | fi | 268 | fi |
269 | 269 | ||
270 | mkdir -p $newdir | 270 | mkdir -p $newdir |
271 | mv $olddir/$base $newfile | 271 | mv $olddir/$base $newfile |
272 | rmdir -p $olddir 2>/dev/null | 272 | rmdir -p $olddir 2>/dev/null |
273 | fi | 273 | fi |
274 | } | 274 | } |
275 | 275 | ||
276 | stripFiles() | 276 | stripFiles() |
277 | { | 277 | { |
278 | for f in $1; do | 278 | for f in $1; do |
279 | stripFile ./$f | 279 | # do not strip links |
280 | if [ ! -h ./$f ] | ||
281 | then | ||
282 | stripFile ./$f | ||
283 | fi | ||
280 | done | 284 | done |
281 | } | 285 | } |
282 | 286 | ||
283 | substFiles() | 287 | substFiles() |
284 | { | 288 | { |
285 | for f in $1; do | 289 | for f in $1; do |
286 | substFile ./$f | 290 | substFile ./$f |
287 | done | 291 | done |
288 | } | 292 | } |
289 | 293 | ||
290 | substAndStripFiles() | 294 | substAndStripFiles() |
291 | { | 295 | { |
292 | for f in $1; do | 296 | for f in $1; do |
293 | stripFile ./$f | 297 | stripFile ./$f |
294 | substFile ./$f $2 | 298 | substFile ./$f $2 |
295 | done | 299 | done |
296 | } | 300 | } |
297 | 301 | ||
298 | installScript() | 302 | installScript() |
299 | { | 303 | { |
300 | if [ -n "$1" -a -f "$1" ]; then | 304 | if [ -n "$1" -a -f "$1" ]; then |
301 | destfile=`basename $1` | 305 | destfile=`basename $1` |
302 | filetype=`echo $destfile|cut -d. -f2` | 306 | filetype=`echo $destfile|cut -d. -f2` |
303 | if [ -n "$filetype" ]; then destfile=$filetype; fi | 307 | if [ -n "$filetype" ]; then destfile=$filetype; fi |
304 | if [ -n "$subst" ]; then | 308 | if [ -n "$subst" ]; then |
305 | sed -f $subst < $1 > $ctrldir/$destfile | 309 | sed -f $subst < $1 > $ctrldir/$destfile |
306 | else | 310 | else |
307 | cat $1 > $ctrldir/$destfile | 311 | cat $1 > $ctrldir/$destfile |
308 | fi | 312 | fi |
309 | chmod +x $ctrldir/$destfile | 313 | chmod +x $ctrldir/$destfile |
310 | fi | 314 | fi |
311 | } | 315 | } |
312 | 316 | ||
313 | tempDir=/tmp/`basename $self`.$$ | 317 | tempDir=/tmp/`basename $self`.$$ |
314 | mkdir -p $tempDir | 318 | mkdir -p $tempDir |
315 | if [ $? != 0 ]; then | 319 | if [ $? != 0 ]; then |
316 | echo "$self: cannot create $tempDir, exiting..." | 320 | echo "$self: cannot create $tempDir, exiting..." |
317 | rm -rf $tempDir | 321 | rm -rf $tempDir |
318 | exit 1 | 322 | exit 1 |
319 | fi | 323 | fi |
320 | 324 | ||
321 | ctrldir=$tempDir/CONTROL | 325 | ctrldir=$tempDir/CONTROL |
322 | 326 | ||
323 | mkdir -p $ctrldir | 327 | mkdir -p $ctrldir |
324 | 328 | ||
325 | if [ ! -e $subst ] || [ -z "$subst" ]; then | 329 | if [ ! -e $subst ] || [ -z "$subst" ]; then |
326 | cat $control > $ctrldir/control.new | 330 | cat $control > $ctrldir/control.new |
327 | else | 331 | else |
328 | sed -f $subst < $control > $ctrldir/control.new | 332 | sed -f $subst < $control > $ctrldir/control.new |
329 | fi | 333 | fi |
330 | 334 | ||
331 | createFileList $ctrldir/control.new ipkgFileList | 335 | createFileList $ctrldir/control.new ipkgFileList |
332 | 336 | ||
333 | if [ "$?" != "0" ]; then | 337 | if [ "$?" != "0" ]; then |
334 | echo "$self: ERROR: missing files, not building $control" | 338 | echo "$self: ERROR: missing files, not building $control" |
335 | rm -rf $tempDir | 339 | rm -rf $tempDir |
336 | exit 1 | 340 | exit 1 |
337 | fi | 341 | fi |
338 | 342 | ||
339 | 343 | ||
340 | cat $ctrldir/control.new | egrep -v '^(Files|FileExcludeMask|FileIncludeMask):' > $ctrldir/control | 344 | cat $ctrldir/control.new | egrep -v '^(Files|FileExcludeMask|FileIncludeMask):' > $ctrldir/control |
341 | rm -f $ctrldir/control.new | 345 | rm -f $ctrldir/control.new |
342 | 346 | ||
343 | ( cd $destdir && tar -cf - $ipkgFileList 2>/dev/null ) | ( cd $tempDir && tar -xf - 2>/dev/null ) | 347 | ( cd $destdir && tar -cf - $ipkgFileList 2>/dev/null ) | ( cd $tempDir && tar -xf - 2>/dev/null ) |
344 | 348 | ||
345 | if [ -z "$filesubst" ]; then | 349 | if [ -z "$filesubst" ]; then |
346 | ( cd $tempDir && stripFiles "$ipkgFileList" ) | 350 | ( cd $tempDir && stripFiles "$ipkgFileList" ) |
347 | else | 351 | else |
348 | if ! (echo $filesubst|grep -q '^/'); then | 352 | if ! (echo $filesubst|grep -q '^/'); then |
349 | filesubst="$oldpwd/$filesubst" | 353 | filesubst="$oldpwd/$filesubst" |
350 | fi | 354 | fi |
351 | ( cd $tempDir && substAndStripFiles "$ipkgFileList" $filesubst ) | 355 | ( cd $tempDir && substAndStripFiles "$ipkgFileList" $filesubst ) |
352 | fi | 356 | fi |
353 | 357 | ||
354 | # removing CVS directories | 358 | # removing CVS directories |
355 | find $tempDir -name CVS -a -type d -print0 | xargs -0 rm -rf | 359 | find $tempDir -name CVS -a -type d -print0 | xargs -0 rm -rf |
356 | 360 | ||
357 | path="`echo "$PATH" | sed -e "s/\:/ /g"`" | 361 | path="`echo "$PATH" | sed -e "s/\:/ /g"`" |
358 | if [ -z "$mkfsjffs2" ]; then | 362 | if [ -z "$mkfsjffs2" ]; then |
359 | for i in $path; do | 363 | for i in $path; do |
360 | if [ -x "$i/mkfs.jffs2" ]; then | 364 | if [ -x "$i/mkfs.jffs2" ]; then |
361 | mkfsjffs2="$i/mkfs.jffs2" | 365 | mkfsjffs2="$i/mkfs.jffs2" |
362 | break | 366 | break |
363 | fi | 367 | fi |
364 | done | 368 | done |
365 | fi | 369 | fi |
366 | 370 | ||
367 | if [ -z "$mkfsjffs2" ]; then | 371 | if [ -z "$mkfsjffs2" ]; then |
368 | echo "$self: WARNING: no mkjfs.jffs2 found in path. Falling back to using du" | 372 | echo "$self: WARNING: no mkjfs.jffs2 found in path. Falling back to using du" |
369 | echo "for size calculation. mkfs.jffs2 is recommended for size calculation" | 373 | echo "for size calculation. mkfs.jffs2 is recommended for size calculation" |
370 | echo "as it calculates the real package size on the compressed file system," | 374 | echo "as it calculates the real package size on the compressed file system," |
371 | echo "in contrast to du calculating the uncompressed size!" | 375 | echo "in contrast to du calculating the uncompressed size!" |
372 | buildsize=`du -h -s $tempDir | awk '{print $1}'` | 376 | buildsize=`du -h -s $tempDir | awk '{print $1}'` |
373 | else | 377 | else |
374 | buildsize=`$mkfsjffs2 -r $tempDir | wc -c` | 378 | buildsize=`$mkfsjffs2 -r $tempDir | wc -c` |
375 | fi | 379 | fi |
376 | 380 | ||
377 | if [ "$buildsize" != "0" ]; then | 381 | if [ "$buildsize" != "0" ]; then |
378 | echo "Installed-Size: $buildsize" >> $ctrldir/control | 382 | echo "Installed-Size: $buildsize" >> $ctrldir/control |
379 | fi | 383 | fi |
380 | 384 | ||
381 | installScript $preinst | 385 | installScript $preinst |
382 | installScript $postinst | 386 | installScript $postinst |
383 | installScript $prerm | 387 | installScript $prerm |
384 | installScript $posrm | 388 | installScript $posrm |
385 | 389 | ||
386 | $ipkgbuild $classic -o $user -g $group $tempDir | 390 | $ipkgbuild $classic -o $user -g $group $tempDir |
387 | 391 | ||
388 | rm -rf $tempDir | 392 | rm -rf $tempDir |
diff --git a/scripts/tothreaded b/scripts/tothreaded index 31ed31e..f916ad8 100755 --- a/scripts/tothreaded +++ b/scripts/tothreaded | |||
@@ -1,136 +1,136 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # PURPOSE : | 3 | # PURPOSE : |
4 | # | 4 | # |
5 | # this script converts a non-threaded control file to a threaded one | 5 | # this script converts a non-threaded control file to a threaded one |
6 | # by extending appropriate names with -mt as extension | 6 | # by extending appropriate names with -mt as extension |
7 | # | 7 | # |
8 | # eg abc.control becoms abc-mt.control | 8 | # eg abc.control becoms abc-mt.control |
9 | # | 9 | # |
10 | 10 | ||
11 | # | 11 | # |
12 | # make sure that the depends expression has enough spaces | 12 | # make sure that the depends expression has enough spaces |
13 | # expression can contian : , ( ) || && | 13 | # expression can contian : , ( ) || && |
14 | # | 14 | # |
15 | tokenize() { | 15 | tokenize() { |
16 | sed "s/,/ & /g" | sed "s/)/ & /g" | sed "s/(/ & /g" | sed "s/|/ & /g" | sed "s/&/ & /g" | 16 | sed "s/,/ & /g" | sed "s/)/ & /g" | sed "s/(/ & /g" | sed "s/|/ & /g" | sed "s/&/ & /g" |
17 | } | 17 | } |
18 | 18 | ||
19 | # | 19 | # |
20 | # function converts package name to threaded equivalend IF the | 20 | # function converts package name to threaded equivalend IF the |
21 | # package file HAS a threaded version | 21 | # package file HAS a threaded version |
22 | # | 22 | # |
23 | findthreadedequiv() { | 23 | findthreadedequiv() { |
24 | local isin i | 24 | local isin i |
25 | for i in $* | 25 | for i in $* |
26 | do | 26 | do |
27 | isin=`grep "^$i\$" "$ALLTHREADEDPKGSFILE"` | 27 | isin=`grep "^$i\$" "$ALLTHREADEDPKGSFILE"` |
28 | if [ -z "$isin" ] | 28 | if [ -z "$isin" ] |
29 | then | 29 | then |
30 | # no threaded package | 30 | # no threaded package |
31 | echo -n "$i " | 31 | echo -n "$i" |
32 | else | 32 | else |
33 | # threaded package | 33 | # threaded package |
34 | echo -n "${isin}-mt " | 34 | echo -n "${isin}-mt" |
35 | fi | 35 | fi |
36 | done | 36 | done |
37 | echo | 37 | echo |
38 | } | 38 | } |
39 | 39 | ||
40 | # | 40 | # |
41 | # signature of binary files | 41 | # signature of binary files |
42 | # currently obsolete | 42 | # currently obsolete |
43 | # | 43 | # |
44 | # ISBINARY="*ELF*LSB*" | 44 | # ISBINARY="*ELF*LSB*" |
45 | 45 | ||
46 | usage() { | 46 | usage() { |
47 | echo "Usage : tothreaded <controlfile> <ALLPackages file>" | 47 | echo "Usage : tothreaded <controlfile> <ALLPackages file>" |
48 | exit 2 | 48 | exit 2 |
49 | } | 49 | } |
50 | 50 | ||
51 | . scripts/SpecialMTFiles | 51 | . scripts/SpecialMTFiles |
52 | 52 | ||
53 | # | 53 | # |
54 | # get the name of the controlfile to check for threading | 54 | # get the name of the controlfile to check for threading |
55 | # | 55 | # |
56 | if [ -z "$1" ] | 56 | if [ -z "$1" ] |
57 | then | 57 | then |
58 | usage | 58 | usage |
59 | fi | 59 | fi |
60 | controlfile=$1 | 60 | controlfile=$1 |
61 | shift | 61 | shift |
62 | 62 | ||
63 | case $controlfile in | 63 | case $controlfile in |
64 | *-mt.control) | 64 | *-mt.control) |
65 | #already threaded | 65 | #already threaded |
66 | echo $controlfile | 66 | echo $controlfile |
67 | exit 0; | 67 | exit 0; |
68 | ;; | 68 | ;; |
69 | esac | 69 | esac |
70 | 70 | ||
71 | # | 71 | # |
72 | # file containing list of all known threaded packages | 72 | # file containing list of all known threaded packages |
73 | # | 73 | # |
74 | if [ -z "$1" ] | 74 | if [ -z "$1" ] |
75 | then | 75 | then |
76 | usage | 76 | usage |
77 | fi | 77 | fi |
78 | ALLTHREADEDPKGSFILE=$1 | 78 | ALLTHREADEDPKGSFILE=$1 |
79 | shift | 79 | shift |
80 | 80 | ||
81 | # | 81 | # |
82 | # strip out the name of the package | 82 | # strip out the name of the package |
83 | # | 83 | # |
84 | packagename=${controlfile##*/} # path | 84 | packagename=${controlfile##*/} # path |
85 | packagename=${packagename%.control} # extension | 85 | packagename=${packagename%.control} # extension |
86 | 86 | ||
87 | # | 87 | # |
88 | # generate new control file | 88 | # generate new control file |
89 | # | 89 | # |
90 | newcontrolfile=${controlfile/\.control/-mt\.control} | 90 | newcontrolfile=${controlfile/\.control/-mt\.control} |
91 | 91 | ||
92 | # | 92 | # |
93 | # read all lines in original control file | 93 | # read all lines in original control file |
94 | # | 94 | # |
95 | while read line | 95 | while read line |
96 | do | 96 | do |
97 | case $line in | 97 | case $line in |
98 | # convert some files to threaded equivalent | 98 | # convert some files to threaded equivalent |
99 | "Files:"*) | 99 | "Files:"*) |
100 | files=${line#Files:} | 100 | files=${line#Files:} |
101 | # thread-converted files | 101 | # thread-converted files |
102 | T_files=`ConvertSpecialFiles "$files"` | 102 | T_files=`ConvertSpecialFiles "$files"` |
103 | echo "Files: $T_files" | 103 | echo "Files: $T_files" |
104 | ;; | 104 | ;; |
105 | "Package: "*) | 105 | "Package: "*) |
106 | T_package=`findthreadedequiv ${line#Package: }` | 106 | T_package=`findthreadedequiv ${line#Package: }` |
107 | echo "Package: ${T_package}" | 107 | echo "Package: ${T_package}" |
108 | ;; | 108 | ;; |
109 | "Depends: "*) | 109 | "Depends: "*) |
110 | depends=`echo "${line#Depends: }" | tokenize` | 110 | depends=`echo "${line#Depends: }" | tokenize` |
111 | T_depends=`findthreadedequiv ${depends}` | 111 | T_depends=`findthreadedequiv ${depends}` |
112 | echo "Depends: $T_depends" | 112 | echo "Depends: $T_depends" |
113 | ;; | 113 | ;; |
114 | "Provides: "*) | 114 | "Provides: "*) |
115 | T_provides=`findthreadedequiv ${line#Provides: }` | 115 | T_provides=`findthreadedequiv ${line#Provides: }` |
116 | echo "Provides: $T_provides" | 116 | echo "Provides: $T_provides" |
117 | ;; | 117 | ;; |
118 | "Recommends: "*) | 118 | "Recommends: "*) |
119 | T_recommends=`findthreadedequiv ${line#Recommends: }` | 119 | T_recommends=`findthreadedequiv ${line#Recommends: }` |
120 | echo "Recommends: $T_recommends" | 120 | echo "Recommends: $T_recommends" |
121 | ;; | 121 | ;; |
122 | "Conflicts: "*) | 122 | "Conflicts: "*) |
123 | conflicts=`echo "${line#Conflicts: }" | tokenize` | 123 | conflicts=`echo "${line#Conflicts: }" | tokenize` |
124 | T_conflicts=`findthreadedequiv ${conflicts}` | 124 | T_conflicts=`findthreadedequiv ${conflicts}` |
125 | echo "Conflicts: $T_conflicts" | 125 | echo "Conflicts: $T_conflicts" |
126 | ;; | 126 | ;; |
127 | *":"*) | 127 | *":"*) |
128 | echo "$line" | 128 | echo "$line" |
129 | ;; | 129 | ;; |
130 | *) # al other lines | 130 | *) # al other lines |
131 | echo " $line" | 131 | echo " $line" |
132 | ;; | 132 | ;; |
133 | esac | 133 | esac |
134 | done < $controlfile > $newcontrolfile | 134 | done < $controlfile > $newcontrolfile |
135 | 135 | ||
136 | echo $newcontrolfile | 136 | echo $newcontrolfile |