rev |
line source |
pankso@7
|
1 #!/bin/sh
|
pankso@7
|
2 # Tazwok - SliTaz source compiler and binary packages generator/cooker.
|
pankso@7
|
3 #
|
pankso@7
|
4 # Tazwok can compile source package and creat binary packages suitable for
|
pankso@7
|
5 # Tazpkg (Tiny Autonomus zone package manager). You can build individuals
|
pankso@7
|
6 # package or a list a packages with one command, rebuild the full distro,
|
pankso@7
|
7 # generate a packages repository and also list and get info about packages.
|
pankso@7
|
8 #
|
pankso@19
|
9 # (C) 2007-2008 SliTaz - GNU General Public License.
|
pankso@7
|
10 #
|
pankso@43
|
11 VERSION=1.5
|
pankso@7
|
12
|
pankso@7
|
13 ####################
|
pankso@7
|
14 # Tazwok variables #
|
pankso@7
|
15 ####################
|
pankso@7
|
16
|
pankso@7
|
17 # Packages categories.
|
pankso@25
|
18 CATEGORIES="
|
pankso@25
|
19 base-system
|
pankso@25
|
20 utilities
|
pankso@25
|
21 network
|
pankso@25
|
22 graphics
|
pankso@25
|
23 multimedia
|
pankso@25
|
24 office
|
pankso@25
|
25 development
|
pankso@25
|
26 system-tools
|
pankso@25
|
27 security
|
pankso@26
|
28 games
|
pankso@26
|
29 misc
|
pankso@43
|
30 meta
|
pankso@43
|
31 non-free"
|
pankso@7
|
32
|
pankso@7
|
33 # Use words rater than numbers in the code.
|
pankso@7
|
34 COMMAND=$1
|
pankso@7
|
35 PACKAGE=$2
|
pankso@7
|
36 LIST=$2
|
pankso@7
|
37
|
pankso@7
|
38 # Include config file or exit if any file found.
|
erjo@38
|
39
|
erjo@38
|
40 if [ -f "./tazwok.conf" ]; then
|
erjo@38
|
41 . ./tazwok.conf
|
erjo@38
|
42 elif [ -f "/etc/tazwok.conf" ]; then
|
pankso@7
|
43 . /etc/tazwok.conf
|
pankso@7
|
44 else
|
pankso@7
|
45 echo -e "\nUnable to find the configuration file : /etc/tazwok.conf"
|
pankso@7
|
46 echo -e "Please read the Tazwok documentation.\n"
|
pankso@7
|
47 exit 0
|
pankso@7
|
48 fi
|
pankso@7
|
49
|
pankso@7
|
50 # Creat Taz wok needed directories if user is root.
|
pankso@7
|
51 if test $(id -u) = 0 ; then
|
pankso@7
|
52 # Check for the wok directory.
|
pankso@7
|
53 if [ ! -d "$WOK" ]; then
|
pankso@7
|
54 echo "Creating the wok directory..."
|
pankso@7
|
55 mkdir -p $WOK
|
pankso@7
|
56 chmod 777 $WOK
|
pankso@7
|
57 fi
|
pankso@7
|
58 # Check for the packages repository.
|
pankso@7
|
59 if [ ! -d "$PACKAGES_REPOSITORY" ]; then
|
pankso@7
|
60 echo "Creating the packages repository..."
|
pankso@7
|
61 mkdir -p $PACKAGES_REPOSITORY
|
pankso@7
|
62 fi
|
pankso@7
|
63 # Check for the sources repository.
|
pankso@7
|
64 if [ ! -d "$SOURCES_REPOSITORY" ]; then
|
pankso@7
|
65 echo "Creating the sources repository..."
|
pankso@17
|
66 mkdir -p $SOURCES_REPOSITORY
|
pankso@7
|
67 fi
|
pankso@7
|
68 fi
|
pankso@7
|
69
|
pankso@7
|
70 # The path to the most important file used by Tazwok.
|
pankso@7
|
71 # The receipt is used to compile the source code and
|
pankso@7
|
72 # gen suitables packages for Tazpkg.
|
pankso@7
|
73 RECEIPT="$WOK/$PACKAGE/receipt"
|
pankso@7
|
74
|
pankso@7
|
75 # The path to the process log file.
|
pankso@7
|
76 LOG="$WOK/$PACKAGE/process.log"
|
pankso@7
|
77
|
pankso@7
|
78 ####################
|
pankso@7
|
79 # Tazwok functions #
|
pankso@7
|
80 ####################
|
pankso@7
|
81
|
pankso@7
|
82 # Print the usage (English).
|
pankso@7
|
83 usage ()
|
pankso@7
|
84 {
|
pankso@7
|
85 echo -e "\nSliTaz sources compiler and packages generator - Version: $VERSION\n
|
pankso@7
|
86 \033[1mUsage: \033[0m `basename $0` [command] [package|list|category|dir] [--option]
|
pankso@7
|
87 \033[1mCommands: \033[0m\n
|
pankso@7
|
88 usage Print this short usage.
|
pankso@7
|
89 stats Print Tazwok statistics from the config file and the wok.
|
pankso@7
|
90 list List all packages in the wok tree or by category.
|
pankso@7
|
91 info Get informations about a package in the wok.
|
pankso@7
|
92 check-log Check the process log file of a package.
|
pankso@7
|
93 search Search for a package in the wok by pattern or name.
|
pankso@7
|
94 compile Configure and build the package using the receipt rules.
|
pankso@7
|
95 genpkg Generate a suitable package for Tazpkg with the rules.
|
pankso@7
|
96 cook Compile and generate a package directly.
|
pankso@7
|
97 cook-list Cook all packages specified in the list by order.
|
pankso@7
|
98 clean Clean all generated files in the package tree.
|
pankso@7
|
99 new-tree Prepare a new package tree and receipt (--interactive).
|
pankso@28
|
100 gen-list Generate a packages lists for a repository (--text).
|
pankso@7
|
101 gen-clean-wok Gen a clean wok in a dir ('clean-wok' cleans current wok).
|
pankso@7
|
102 remove Remove a package from the wok.\n"
|
pankso@7
|
103 }
|
pankso@7
|
104
|
pankso@7
|
105 # Status function.
|
pankso@7
|
106 status()
|
pankso@7
|
107 {
|
pankso@7
|
108 local CHECK=$?
|
pankso@7
|
109 echo -en "\\033[70G[ "
|
pankso@7
|
110 if [ $CHECK = 0 ]; then
|
pankso@7
|
111 echo -en "\\033[1;33mOK"
|
pankso@7
|
112 else
|
pankso@7
|
113 echo -en "\\033[1;31mFailed"
|
pankso@7
|
114 fi
|
pankso@7
|
115 echo -e "\\033[0;39m ]"
|
pankso@7
|
116 }
|
pankso@7
|
117
|
pankso@7
|
118 # Check if user is root.
|
pankso@7
|
119 check_root()
|
pankso@7
|
120 {
|
pankso@7
|
121 if test $(id -u) != 0 ; then
|
pankso@7
|
122 echo -e "\nYou must be root to run `basename $0` with this option."
|
pankso@7
|
123 echo -e "Please type 'su' and root password to become super-user.\n"
|
pankso@7
|
124 exit 0
|
pankso@7
|
125 fi
|
pankso@7
|
126 }
|
pankso@7
|
127
|
pankso@7
|
128 # Check for a package name on cmdline.
|
pankso@7
|
129 check_for_package_on_cmdline()
|
pankso@7
|
130 {
|
pankso@7
|
131 if [ -z "$PACKAGE" ]; then
|
pankso@7
|
132 echo -e "\nYou must specify a package name on the command line."
|
pankso@7
|
133 echo -e "Example : tazwok $COMMAND package\n"
|
pankso@7
|
134 exit 0
|
pankso@7
|
135 fi
|
pankso@7
|
136 }
|
pankso@7
|
137
|
pankso@7
|
138 # Check for the receipt of a package used to cook.
|
pankso@7
|
139 check_for_receipt()
|
pankso@7
|
140 {
|
pankso@7
|
141 if [ ! -f "$RECEIPT" ]; then
|
pankso@7
|
142 echo -e "\nUnable to find the receipt : $RECEIPT\n"
|
pankso@7
|
143 exit 0
|
pankso@7
|
144 fi
|
pankso@7
|
145 }
|
pankso@7
|
146
|
pankso@7
|
147 # Check for a specified file list on cmdline.
|
pankso@7
|
148 check_for_list()
|
pankso@7
|
149 {
|
pankso@7
|
150 if [ -z "$LIST" ]; then
|
pankso@7
|
151 echo -e "\nPlease specify the path to the list of packages to cook.\n"
|
pankso@7
|
152 exit 0
|
pankso@7
|
153 fi
|
pankso@7
|
154 # Check if the list of packages exist.
|
pankso@7
|
155 if [ -f "$LIST" ]; then
|
pankso@7
|
156 LIST=`cat $LIST`
|
pankso@7
|
157 else
|
pankso@7
|
158 echo -e "\nUnable to find $LIST packages list.\n"
|
pankso@7
|
159 exit 0
|
pankso@7
|
160 fi
|
pankso@7
|
161 }
|
pankso@7
|
162
|
pankso@7
|
163 # Check for the wanted package if specified in WANTED
|
pankso@7
|
164 # receipt variable. Set the $src/$_pkg variable to help compiling
|
pankso@7
|
165 # and generating packages.
|
pankso@7
|
166 check_for_wanted()
|
pankso@7
|
167 {
|
pankso@7
|
168 if [ ! "$WANTED" = "" ]; then
|
pankso@7
|
169 echo -n "Checking for the wanted package..."
|
pankso@7
|
170 if [ ! -d "$WOK/$WANTED" ]; then
|
pankso@7
|
171 echo -e "\nWanted package is missing in the work directory.\n"
|
pankso@7
|
172 exit 0
|
pankso@7
|
173 fi
|
erjo@38
|
174 # Checking for buildtree of Wanted package
|
pankso@39
|
175 if [ ! -d "$WOK/$WANTED/taz" ]; then
|
erjo@38
|
176 echo -e "\n\nSource files of wanted package is missing in the work directory."
|
erjo@38
|
177 echo -n "Would you like to build the missing package (y/N) ? " ; read anser
|
erjo@38
|
178 if [ "$anser" == "y" ]; then
|
erjo@38
|
179 tazwok cook $WANTED
|
erjo@38
|
180 else
|
erjo@38
|
181 echo -e "\nWanted package source tree is missing in the work directory.\n"
|
erjo@38
|
182 exit 0
|
erjo@38
|
183 fi
|
erjo@38
|
184 fi
|
pankso@7
|
185 status
|
pankso@7
|
186 # Set wanted src path.
|
pankso@7
|
187 src=$WOK/$WANTED/$WANTED-$VERSION
|
pankso@7
|
188 _pkg=$src/_pkg
|
pankso@7
|
189 fi
|
pankso@7
|
190 }
|
pankso@7
|
191
|
erjo@38
|
192
|
pankso@40
|
193 # Check for build dependencies, notify user and install if specified.
|
pankso@18
|
194 check_for_build_depends()
|
pankso@18
|
195 {
|
pankso@18
|
196 echo "Checking for build dependencies..."
|
pankso@18
|
197 for pkg in $BUILD_DEPENDS
|
pankso@18
|
198 do
|
pankso@18
|
199 if [ ! -d "/var/lib/tazpkg/installed/$pkg" ]; then
|
pankso@18
|
200 MISSING_PACKAGE=$pkg
|
pankso@18
|
201 fi
|
pankso@18
|
202 done
|
pankso@18
|
203 if [ ! "$MISSING_PACKAGE" = "" ]; then
|
pankso@18
|
204 echo "================================================================================"
|
pankso@18
|
205 for pkg in $BUILD_DEPENDS
|
pankso@18
|
206 do
|
pankso@18
|
207 if [ ! -d "/var/lib/tazpkg/installed/$pkg" ]; then
|
pankso@18
|
208 MISSING_PACKAGE=$pkg
|
pankso@18
|
209 echo "Missing : $pkg"
|
pankso@18
|
210 fi
|
pankso@18
|
211 done
|
pankso@18
|
212 echo "================================================================================"
|
pankso@40
|
213 echo "You can continue, exit or install missing dependencies."
|
pankso@40
|
214 echo -n "Install, continue or exit (install/y/N) ? "; read anser
|
pankso@40
|
215 case $anser in
|
pankso@40
|
216 install)
|
pankso@40
|
217 for pkg in $BUILD_DEPENDS
|
pankso@40
|
218 do
|
pankso@40
|
219 if [ ! -d "/var/lib/tazpkg/installed/$pkg" ]; then
|
pankso@40
|
220 tazpkg get-install $pkg
|
pankso@40
|
221 fi
|
pankso@40
|
222 done ;;
|
pankso@40
|
223 y|yes)
|
pankso@40
|
224 continue ;;
|
pankso@40
|
225 *)
|
pankso@40
|
226 exit 0 ;;
|
pankso@40
|
227 esac
|
pankso@18
|
228 fi
|
pankso@18
|
229 }
|
pankso@18
|
230
|
pankso@7
|
231 # Configure and make a package with the receipt.
|
pankso@7
|
232 compile_package()
|
pankso@7
|
233 {
|
pankso@7
|
234 check_for_package_on_cmdline
|
pankso@7
|
235 # Include the receipt to get all needed variables and functions
|
pankso@7
|
236 # and cd into the work directory to start the work.
|
pankso@7
|
237 check_for_receipt
|
pankso@7
|
238 . $RECEIPT
|
pankso@7
|
239 # Log the package name and date.
|
pankso@7
|
240 echo "date `date +%Y%m%d\ \%H:%M:%S`" >> $LOG
|
pankso@7
|
241 echo "package $PACKAGE (compile)" >> $LOG
|
pankso@7
|
242 # Set wanted $src variable to help compiling.
|
pankso@7
|
243 if [ ! "$SOURCE" = "" ]; then
|
pankso@7
|
244 src=$WOK/$PACKAGE/$SOURCE-$VERSION
|
pankso@7
|
245 else
|
pankso@7
|
246 src=$WOK/$PACKAGE/$PACKAGE-$VERSION
|
pankso@7
|
247 fi
|
pankso@18
|
248 check_for_build_depends
|
pankso@7
|
249 check_for_wanted
|
pankso@7
|
250 echo ""
|
pankso@7
|
251 echo "Starting to cook $PACKAGE..."
|
pankso@7
|
252 echo "================================================================================"
|
pankso@7
|
253 # Check for src tarball and wget if needed.
|
pankso@28
|
254 if [ ! "$WGET_URL" = "" ]; then
|
pankso@7
|
255 echo "Checking for source tarball... "
|
pankso@7
|
256 if [ ! -f "$SOURCES_REPOSITORY/$TARBALL" ]; then
|
pankso@7
|
257 cd $SOURCES_REPOSITORY
|
pankso@7
|
258 wget $WGET_URL
|
pankso@7
|
259 # Exit if download failed to avoid errors.
|
pankso@7
|
260 if [ ! -f "$SOURCES_REPOSITORY/$TARBALL" ]; then
|
pankso@7
|
261 echo -e "\nDownload failed, exiting. Please check WGET_URL variable.\n"
|
pankso@7
|
262 exit 1
|
pankso@7
|
263 fi
|
pankso@7
|
264 else
|
pankso@7
|
265 echo -n "Source tarball exit... "
|
pankso@7
|
266 status
|
pankso@7
|
267 fi
|
pankso@7
|
268 # Untaring source if necessary. We dont need to extract source if
|
pankso@7
|
269 # the package is build with a wanted source package.
|
pankso@7
|
270 if [ "$WANTED" = "" ]; then
|
pankso@7
|
271 if [ ! -d $src ]; then
|
pankso@7
|
272 # Log process.
|
pankso@7
|
273 echo "untaring $TARBALL" >> $LOG
|
pankso@7
|
274 echo -n "Untaring $TARBALL... "
|
pankso@7
|
275 if [ "`basename $TARBALL | grep tar.bz2`" ]; then
|
pankso@7
|
276 tar xjf $SOURCES_REPOSITORY/$TARBALL -C $WOK/$PACKAGE
|
pankso@7
|
277 else
|
pankso@7
|
278 tar xzf $SOURCES_REPOSITORY/$TARBALL -C $WOK/$PACKAGE
|
pankso@7
|
279 fi
|
pankso@7
|
280 status
|
pankso@7
|
281 else
|
pankso@7
|
282 echo -n "Source direcory exit... " && status
|
pankso@7
|
283 fi
|
pankso@7
|
284 fi
|
pankso@7
|
285 fi
|
pankso@7
|
286 cd $WOK/$PACKAGE
|
pankso@7
|
287 # Log and execute compile_rules function if it exist, to configure and
|
pankso@7
|
288 # make the package if it exist.
|
pankso@28
|
289 if grep -q ^compile_rules $RECEIPT; then
|
pankso@7
|
290 echo "executing compile_rules" >> $LOG
|
pankso@7
|
291 compile_rules
|
pankso@7
|
292 # Exit if compilation failed so the binary package
|
pankso@7
|
293 # is not generated when using the cook comand.
|
pankso@7
|
294 local CHECK=$?
|
pankso@7
|
295 if [ $CHECK = 0 ]; then
|
pankso@7
|
296 echo "================================================================================"
|
pankso@7
|
297 echo "$PACKAGE compiled on : `date +%Y%m%d\ \%H:%M:%S`"
|
pankso@7
|
298 echo ""
|
pankso@7
|
299 echo "compilation done : `date +%Y%m%d\ \%H:%M:%S`" >> $LOG
|
pankso@7
|
300 else
|
pankso@7
|
301 echo "================================================================================"
|
pankso@7
|
302 echo "Compilation failed. Please read the compilator output."
|
pankso@7
|
303 echo "" && exit 1
|
pankso@7
|
304 fi
|
pankso@7
|
305 else
|
pankso@7
|
306 echo "no compile_rules" >> $LOG
|
pankso@7
|
307 echo -e "No compile rules for $PACKAGE...\n"
|
pankso@7
|
308 fi
|
pankso@7
|
309 }
|
pankso@7
|
310
|
pankso@22
|
311 # Copy all generic files (locale, pixmaps, .desktop). We use standard path,
|
pankso@22
|
312 # so some packages need to copy these files with the receipt and genpkg_rules.
|
pankso@22
|
313 # This function is executed by gen_package when 'tazwok genpkg'.
|
pankso@22
|
314 copy_generic_files()
|
pankso@22
|
315 {
|
pankso@22
|
316 # In most case locale are in $_pkg/usr/share/locale so we copy files
|
pankso@22
|
317 # using generic variables and $LOCALE from Tazwok config file.
|
pankso@22
|
318 if [ ! "$LOCALE" = "" ]; then
|
pankso@22
|
319 if [ -d "$_pkg/usr/share/locale" ]; then
|
pankso@22
|
320 for i in $LOCALE
|
pankso@22
|
321 do
|
pankso@37
|
322 if [ -d "$_pkg/usr/share/locale/$i" ]; then
|
pankso@37
|
323 mkdir -p $fs/usr/share/locale
|
pankso@37
|
324 cp -a $_pkg/usr/share/locale/$i $fs/usr/share/locale
|
pankso@37
|
325 fi
|
pankso@22
|
326 done
|
pankso@22
|
327 fi
|
pankso@22
|
328 fi
|
pankso@31
|
329 # Pixmaps (PNG or/and XPM only). Some icons/images can be add trough
|
pankso@31
|
330 # genpkg_rules and generic copy can be disable with GENERIC_PIXMAPS="no"
|
pankso@31
|
331 # in pkg receipt.
|
pankso@22
|
332 if [ ! "$GENERIC_PIXMAPS" = "no" ]; then
|
pankso@22
|
333 if [ -d "$_pkg/usr/share/pixmaps" ]; then
|
pankso@27
|
334 mkdir -p $fs/usr/share/pixmaps
|
pankso@31
|
335 cp -a $_pkg/usr/share/pixmaps/$PACKAGE.png \
|
pankso@31
|
336 $fs/usr/share/pixmaps 2>/dev/null
|
pankso@31
|
337 cp -a $_pkg/usr/share/pixmaps/$PACKAGE.xpm \
|
pankso@22
|
338 $fs/usr/share/pixmaps 2>/dev/null
|
pankso@23
|
339 fi
|
pankso@23
|
340 # Custom or home made PNG pixmap can be in stuff.
|
pankso@23
|
341 if [ -f "stuff/$PACKAGE.png" ]; then
|
pankso@27
|
342 mkdir -p $fs/usr/share/pixmaps
|
pankso@23
|
343 cp -a stuff/$PACKAGE.png $fs/usr/share/pixmaps
|
pankso@22
|
344 fi
|
pankso@22
|
345 fi
|
pankso@22
|
346 # Desktop entry (.desktop).
|
pankso@22
|
347 if [ -d "$_pkg/usr/share/applications" ]; then
|
pankso@22
|
348 cp -a $_pkg/usr/share/applications $fs/usr/share
|
pankso@23
|
349 fi
|
pankso@32
|
350 # Home made desktop file(s) can be in stuff.
|
pankso@34
|
351 if [ -d "stuff/applications" ]; then
|
pankso@42
|
352 mkdir -p $fs/usr/share
|
pankso@42
|
353 cp -a stuff/applications $fs/usr/share
|
pankso@34
|
354 fi
|
pankso@34
|
355 if [ -f "stuff/$PACKAGE.desktop" ]; then
|
pankso@42
|
356 mkdir -p $fs/usr/share/applications
|
pankso@42
|
357 cp -a stuff/$PACKAGE.desktop $fs/usr/share/applications
|
pankso@22
|
358 fi
|
pankso@22
|
359 }
|
pankso@22
|
360
|
pankso@25
|
361 # Find and strip : --strip-all (-s) or --strip-debug on static libs.
|
pankso@25
|
362 strip_package()
|
pankso@25
|
363 {
|
pankso@25
|
364 echo -n "Executing strip on all files..."
|
pankso@25
|
365 # Binaries.
|
pankso@25
|
366 for dir in $fs/bin $fs/sbin $fs/usr/bin $fs/usr/sbin $fs/usr/games
|
pankso@25
|
367 do
|
pankso@25
|
368 if [ -d "$dir" ]; then
|
pankso@25
|
369 find $dir -type f -exec strip -s '{}' 2>/dev/null \;
|
pankso@25
|
370 fi
|
pankso@25
|
371 done
|
pankso@25
|
372 # Libraries.
|
pankso@25
|
373 find $fs -name "*.so*" -exec strip -s '{}' 2>/dev/null \;
|
pankso@25
|
374 find $fs -name "*.a" -exec strip --strip-debug '{}' 2>/dev/null \;
|
pankso@25
|
375 status
|
pankso@25
|
376 }
|
pankso@25
|
377
|
pankso@7
|
378 # Creat a package tree and build the gziped cpio archive
|
pankso@7
|
379 # to make a SliTaz (.tazpkg) package.
|
pankso@7
|
380 gen_package()
|
pankso@7
|
381 {
|
pankso@7
|
382 check_root
|
pankso@7
|
383 check_for_package_on_cmdline
|
pankso@7
|
384 check_for_receipt
|
pankso@7
|
385 . $RECEIPT
|
pankso@7
|
386 check_for_wanted
|
pankso@7
|
387 cd $WOK/$PACKAGE
|
pankso@7
|
388 # Remove old Tazwok package files.
|
pankso@7
|
389 if [ -d "taz" ]; then
|
pankso@7
|
390 rm -rf taz
|
pankso@7
|
391 rm -f $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg
|
pankso@7
|
392 fi
|
pankso@7
|
393 # Creat the package tree and set usful variables.
|
pankso@7
|
394 mkdir -p taz/$PACKAGE-$VERSION/fs
|
pankso@7
|
395 fs=taz/$PACKAGE-$VERSION/fs
|
pankso@7
|
396 # Set $src for standards package and $_pkg variables.
|
pankso@7
|
397 if [ "$WANTED" = "" ]; then
|
pankso@7
|
398 src=$WOK/$PACKAGE/$PACKAGE-$VERSION
|
pankso@7
|
399 _pkg=$src/_pkg
|
pankso@7
|
400 fi
|
pankso@7
|
401 if [ ! "$SOURCE" = "" ]; then
|
pankso@7
|
402 src=$WOK/$PACKAGE/$SOURCE-$VERSION
|
pankso@7
|
403 _pkg=$src/_pkg
|
pankso@7
|
404 fi
|
pankso@7
|
405 cd $WOK/$PACKAGE
|
pankso@22
|
406 # Execute genpkg_rules and copy generic files to build the package.
|
pankso@7
|
407 echo ""
|
pankso@7
|
408 echo "Bulding $PACKAGE with the receipt..."
|
pankso@7
|
409 echo "================================================================================"
|
pankso@28
|
410 if grep -q ^genpkg_rules $RECEIPT; then
|
pankso@7
|
411 # Log process.
|
pankso@7
|
412 echo "executing genpkg_rules" >> $LOG
|
pankso@7
|
413 genpkg_rules
|
pankso@25
|
414 cd $WOK/$PACKAGE
|
pankso@24
|
415 # Skip generic files for packages with a WANTED variable
|
pankso@24
|
416 # (dev and splited pkgs).
|
pankso@24
|
417 if [ ! "$WANTED" = "" ]; then
|
pankso@24
|
418 continue
|
pankso@24
|
419 else
|
pankso@24
|
420 copy_generic_files
|
pankso@24
|
421 fi
|
pankso@25
|
422 strip_package
|
pankso@7
|
423 else
|
pankso@7
|
424 echo "No package rules to gen $PACKAGE..."
|
pankso@22
|
425 exit 1
|
pankso@7
|
426 fi
|
pankso@22
|
427 # Copy the receipt and description (if exist) in the binary package tree.
|
pankso@7
|
428 cd $WOK/$PACKAGE
|
pankso@7
|
429 echo -n "Copying the receipt..."
|
pankso@7
|
430 cp receipt taz/$PACKAGE-$VERSION
|
pankso@7
|
431 status
|
pankso@7
|
432 if [ -f "description.txt" ]; then
|
pankso@7
|
433 echo -n "Copying the description file..."
|
pankso@7
|
434 cp description.txt taz/$PACKAGE-$VERSION
|
pankso@7
|
435 status
|
pankso@7
|
436 fi
|
pankso@7
|
437 # Creat the files.list by redirecting find outpout.
|
pankso@7
|
438 echo -n "Creating the list of files..."
|
pascal@15
|
439 cd taz/$PACKAGE-$VERSION
|
pascal@13
|
440 LAST_FILE=""
|
pascal@15
|
441 ( find fs -print; echo ) | while read file; do
|
pascal@13
|
442 if [ "$LAST_FILE" != "" ]; then
|
pascal@15
|
443 case "$file" in
|
pascal@13
|
444 $LAST_FILE/*)
|
pascal@15
|
445 case "$(ls -ld "$LAST_FILE")" in
|
pascal@15
|
446 drwxr-xr-x\ *\ root\ *\ root\ *);;
|
pascal@15
|
447 *) echo ${LAST_FILE#fs};;
|
pascal@13
|
448 esac;;
|
pascal@15
|
449 *) echo ${LAST_FILE#fs};;
|
pascal@13
|
450 esac
|
pascal@13
|
451 fi
|
pascal@15
|
452 LAST_FILE="$file"
|
pascal@15
|
453 done > files.list
|
pankso@7
|
454 status
|
pankso@7
|
455 # Build cpio archives. Find, cpio and gzip the fs, finish by
|
pankso@7
|
456 # removing the fs tree.
|
pankso@7
|
457 echo -n "Compressing the fs... "
|
pascal@13
|
458 find fs -print | cpio -o -H newc | gzip > fs.cpio.gz && rm -rf fs
|
pankso@7
|
459 echo -n "Creating full cpio archive... "
|
pankso@7
|
460 find . -print | cpio -o -H newc > $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg
|
pankso@7
|
461 # Restore package tree in case we want to browse it.
|
pankso@7
|
462 echo -n "Restoring original package tree... "
|
pascal@14
|
463 zcat fs.cpio.gz | cpio -id
|
pascal@14
|
464 rm fs.cpio.gz && cd ..
|
pankso@7
|
465 # Log process.
|
pankso@7
|
466 echo "$PACKAGE-$VERSION.tazpkg (done)" >> $LOG
|
pankso@7
|
467 echo "================================================================================"
|
pankso@7
|
468 echo "Package $PACKAGE ($VERSION) generated."
|
pankso@7
|
469 echo "Size : `du -sh $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg`"
|
pankso@7
|
470 echo ""
|
pankso@7
|
471 }
|
pankso@7
|
472
|
pankso@28
|
473 # Optional text packages list for gen-list.
|
pankso@28
|
474 gen_textlist()
|
pankso@28
|
475 {
|
pankso@28
|
476 DATE=`date +%Y-%m-%d\ \%H:%M:%S`
|
pankso@28
|
477 echo -n "Creating the text packages list... "
|
pankso@28
|
478 cat >> packages.txt << _EOT_
|
pankso@28
|
479 # SliTaz GNU/Linux - Packages list
|
pankso@28
|
480 #
|
pankso@28
|
481 # Packages : _packages_
|
pankso@28
|
482 # Date : $DATE
|
pankso@28
|
483 #
|
pankso@28
|
484 _EOT_
|
pankso@28
|
485 for pkg in $WOK/*
|
pankso@28
|
486 do
|
pankso@28
|
487 . $pkg/receipt
|
pankso@28
|
488 cat >> packages.txt << _EOT_
|
pankso@28
|
489
|
pankso@28
|
490 $PACKAGE
|
pankso@28
|
491 $VERSION
|
pankso@28
|
492 $SHORT_DESC
|
pankso@28
|
493 _EOT_
|
pankso@28
|
494 packages=$(($packages+1))
|
pankso@28
|
495 done && status
|
pankso@28
|
496 sed -i s/"_packages_"/"$packages"/ packages.txt
|
pankso@28
|
497 }
|
pankso@28
|
498
|
pankso@7
|
499 ###################
|
pankso@7
|
500 # Tazwok commands #
|
pankso@7
|
501 ###################
|
pankso@7
|
502
|
pankso@7
|
503 case "$COMMAND" in
|
pankso@7
|
504 stats)
|
pankso@7
|
505 # Tazwok general statistics from the config file the wok.
|
pankso@7
|
506 #
|
pankso@7
|
507 echo ""
|
pankso@7
|
508 echo -e "\033[1mTazwok configuration statistics\033[0m
|
pankso@7
|
509 ================================================================================
|
pankso@7
|
510 Wok directory : $WOK
|
pankso@7
|
511 Packages repository : $PACKAGES_REPOSITORY
|
pankso@7
|
512 Sources repository : $SOURCES_REPOSITORY
|
pankso@7
|
513 Packages in the wok : `ls -1 $WOK | wc -l`
|
pankso@16
|
514 Cooked packages : `ls -1 $PACKAGES_REPOSITORY/*.tazpkg 2>/dev/null | wc -l`
|
pankso@7
|
515 ================================================================================"
|
pankso@7
|
516 echo ""
|
pankso@7
|
517 ;;
|
pankso@7
|
518 list)
|
pankso@7
|
519 # List packages in wok directory. User can specifiy a category
|
pankso@7
|
520 #
|
pankso@7
|
521 if [ "$2" = "category" ]; then
|
pankso@7
|
522 echo -e "\033[1m\nPackages categories :\033[0m $CATEGORIES\n"
|
pankso@7
|
523 exit 0
|
pankso@7
|
524 fi
|
pankso@7
|
525 # Check for an asked category.
|
pankso@7
|
526 if [ -n "$2" ]; then
|
pankso@7
|
527 ASKED_CATEGORY=$2
|
pankso@7
|
528 echo ""
|
pankso@7
|
529 echo -e "\033[1mPackages in category :\033[0m $ASKED_CATEGORY"
|
pankso@7
|
530 echo "================================================================================"
|
pankso@7
|
531 for pkg in $WOK/*
|
pankso@7
|
532 do
|
pankso@7
|
533 . $pkg/receipt
|
pankso@7
|
534 if [ "$CATEGORY" == "$ASKED_CATEGORY" ]; then
|
pankso@7
|
535 echo -n "$PACKAGE"
|
pankso@28
|
536 echo -e "\033[28G $VERSION"
|
pankso@7
|
537 packages=$(($packages+1))
|
pankso@7
|
538 fi
|
pankso@7
|
539 done
|
pankso@7
|
540 echo "================================================================================"
|
pankso@7
|
541 echo -e "$packages packages in category $ASKED_CATEGORY.\n"
|
pankso@7
|
542 else
|
pankso@7
|
543 # By default list all packages and version.
|
pankso@7
|
544 echo ""
|
pankso@7
|
545 echo -e "\033[1mList of packages in the wok\033[0m"
|
pankso@7
|
546 echo "================================================================================"
|
pankso@7
|
547 for pkg in $WOK/*
|
pankso@7
|
548 do
|
pankso@7
|
549 . $pkg/receipt
|
pankso@7
|
550 echo -n "$PACKAGE"
|
pankso@28
|
551 echo -en "\033[28G $VERSION"
|
pankso@7
|
552 echo -e "\033[42G $CATEGORY"
|
pankso@7
|
553 packages=$(($packages+1))
|
pankso@7
|
554 done
|
pankso@7
|
555 echo "================================================================================"
|
pankso@7
|
556 echo -e "$packages packages avalaible in the wok.\n"
|
pankso@7
|
557 fi
|
pankso@7
|
558 ;;
|
pankso@7
|
559 info)
|
pankso@7
|
560 # Informations about package.
|
pankso@7
|
561 #
|
pankso@7
|
562 check_for_package_on_cmdline
|
pankso@7
|
563 check_for_receipt
|
pankso@7
|
564 . $WOK/$PACKAGE/receipt
|
pankso@7
|
565 echo ""
|
pankso@7
|
566 echo -e "\033[1mTazwok package informations\033[0m
|
pankso@7
|
567 ================================================================================
|
pankso@7
|
568 Package : $PACKAGE
|
pankso@7
|
569 Version : $VERSION
|
pankso@7
|
570 Category : $CATEGORY
|
pankso@7
|
571 Short desc : $SHORT_DESC
|
pankso@7
|
572 Maintainer : $MAINTAINER"
|
pankso@7
|
573 if [ ! "$WEB_SITE" = "" ]; then
|
pankso@7
|
574 echo "Web site : $WEB_SITE"
|
pankso@7
|
575 fi
|
pankso@7
|
576 if [ ! "$DEPENDS" = "" ]; then
|
pankso@7
|
577 echo "Depends : $DEPENDS"
|
pankso@7
|
578 fi
|
pankso@7
|
579 if [ ! "$WANTED" = "" ]; then
|
pankso@7
|
580 echo "Wanted src : $WANTED"
|
pankso@7
|
581 fi
|
pankso@7
|
582 echo "================================================================================"
|
pankso@7
|
583 echo ""
|
pankso@7
|
584
|
pankso@7
|
585 ;;
|
pankso@7
|
586 check-log)
|
pankso@7
|
587 # We just cat the file log to view process info.
|
pankso@7
|
588 #
|
pankso@7
|
589 if [ ! -f "$LOG" ]; then
|
pankso@7
|
590 echo -e "\nNo process log found. The package is probably not cook.\n"
|
pankso@7
|
591 exit 0
|
pankso@7
|
592 else
|
pankso@7
|
593 echo ""
|
pankso@7
|
594 echo -e "\033[1mPackage process log for :\033[0m $PACKAGE"
|
pankso@7
|
595 echo "================================================================================"
|
pankso@7
|
596 cat $LOG
|
pankso@7
|
597 echo "================================================================================"
|
pankso@7
|
598 echo ""
|
pankso@7
|
599 fi
|
pankso@7
|
600 ;;
|
pankso@7
|
601 search)
|
pankso@7
|
602 # Search for a package by pattern or name.
|
pankso@7
|
603 #
|
pankso@7
|
604 if [ -z "$2" ]; then
|
pankso@7
|
605 echo -e "\nPlease specify a pattern or a package name to search."
|
pankso@7
|
606 echo -e "Example : 'tazwok search gcc'.\n"
|
pankso@7
|
607 exit 0
|
pankso@7
|
608 fi
|
pankso@7
|
609 echo ""
|
pankso@7
|
610 echo -e "\033[1mSearch result for :\033[0m $2"
|
pankso@7
|
611 echo "================================================================================"
|
pankso@7
|
612 list=`ls -1 $WOK | grep $2`
|
pankso@7
|
613 for pkg in $list
|
pankso@7
|
614 do
|
pankso@7
|
615 . $WOK/$pkg/receipt
|
pankso@7
|
616 echo -n "$PACKAGE "
|
pankso@7
|
617 echo -en "\033[24G $VERSION"
|
pankso@7
|
618 echo -e "\033[42G $CATEGORY"
|
pankso@7
|
619 packages=$(($packages+1))
|
pankso@7
|
620 done
|
pankso@7
|
621 echo "================================================================================"
|
pankso@7
|
622 echo "$packages packages found for : $2"
|
pankso@7
|
623 echo ""
|
pankso@7
|
624 ;;
|
pankso@7
|
625 compile)
|
pankso@7
|
626 # Configure and make a package with the receipt.
|
pankso@7
|
627 #
|
pankso@7
|
628 compile_package
|
pankso@7
|
629 ;;
|
pankso@7
|
630 genpkg)
|
pankso@7
|
631 # Generate a package
|
pankso@7
|
632 #
|
pankso@7
|
633 gen_package
|
pankso@7
|
634 ;;
|
pankso@7
|
635 cook)
|
pankso@7
|
636 # Compile and generate a package. Just execute tazwok with
|
pankso@7
|
637 # the good commands.
|
pankso@7
|
638 #
|
pankso@7
|
639 check_root
|
pankso@7
|
640 compile_package
|
pankso@7
|
641 gen_package
|
pankso@7
|
642 ;;
|
pankso@7
|
643 cook-list)
|
pankso@7
|
644 # Cook all packages listed in a file. The path to the cooklist must
|
pankso@7
|
645 # be specified on the cmdline.
|
pankso@7
|
646 #
|
pankso@7
|
647 check_root
|
pankso@7
|
648 check_for_list
|
pankso@7
|
649 for pkg in $LIST
|
pankso@7
|
650 do
|
pankso@7
|
651 tazwok compile $pkg
|
pankso@7
|
652 tazwok genpkg $pkg
|
pankso@7
|
653 done
|
pankso@7
|
654 ;;
|
pankso@7
|
655 clean)
|
pankso@7
|
656 # Clean up a package work directory.
|
pankso@7
|
657 #
|
pankso@7
|
658 check_for_package_on_cmdline
|
pankso@7
|
659 check_for_receipt
|
pankso@7
|
660 . $RECEIPT
|
pankso@7
|
661 cd $WOK/$PACKAGE
|
pankso@7
|
662 echo ""
|
pankso@7
|
663 echo "Cleaning $PACKAGE..."
|
pankso@7
|
664 echo "================================================================================"
|
pankso@28
|
665 # Check for clean_wok function.
|
pankso@28
|
666 if grep -q ^clean_wok $RECEIPT; then
|
pankso@28
|
667 clean_wok
|
pankso@28
|
668 fi
|
pankso@28
|
669 # Remove taz/ and source tree if exist.
|
pankso@7
|
670 if [ -d "taz" ]; then
|
pankso@7
|
671 echo -n "Removing taz files..."
|
pankso@7
|
672 rm -rf taz && status
|
pankso@7
|
673 fi
|
pankso@7
|
674 if [ -d "$PACKAGE-$VERSION" ]; then
|
pankso@7
|
675 echo -n "Removing source files..."
|
pankso@7
|
676 rm -rf $PACKAGE-$VERSION && status
|
pankso@7
|
677 fi
|
pankso@7
|
678 if [ -d "$SOURCE-$VERSION" ]; then
|
pankso@7
|
679 echo -n "Removing source files..."
|
pankso@7
|
680 rm -rf $SOURCE-$VERSION && status
|
pankso@7
|
681 fi
|
pankso@7
|
682 # Remove an envental $PACKAGE-build directory.
|
pankso@7
|
683 if [ -d "$PACKAGE-build" ]; then
|
pankso@7
|
684 echo -n "Removing build tree..."
|
pankso@7
|
685 rm -rf $PACKAGE-build && status
|
pankso@7
|
686 fi
|
pankso@7
|
687 # Remove process log file.
|
pankso@7
|
688 if [ -f "process.log" ]; then
|
pankso@7
|
689 echo -n "Removing process log file..."
|
pankso@7
|
690 rm process.log && status
|
pankso@28
|
691 echo "================================================================================"
|
pankso@7
|
692 fi
|
pankso@7
|
693 echo "$PACKAGE is clean. You can cook it again..."
|
pankso@7
|
694 echo ""
|
pankso@7
|
695 ;;
|
pankso@7
|
696 gen-clean-wok)
|
pankso@7
|
697 # Generate a clean wok from the current wok by copying all receipt
|
pankso@7
|
698 # and stuff directory.
|
pankso@7
|
699 #
|
pankso@7
|
700 if [ -z "$2" ]; then
|
pankso@7
|
701 echo -e "\nPlease specify the destination for the new clean wok.\n"
|
pankso@7
|
702 exit 0
|
pankso@7
|
703 else
|
pankso@7
|
704 dest=$2
|
pankso@7
|
705 mkdir -p $dest
|
pankso@7
|
706 fi
|
pankso@7
|
707 echo "New wok is going to : $dest"
|
pankso@7
|
708 for pkg in `ls -1 $WOK`
|
pankso@7
|
709 do
|
pankso@7
|
710 echo "----"
|
pankso@7
|
711 echo -n "Preparing $pkg..."
|
pankso@7
|
712 mkdir -p $dest/$pkg
|
pankso@7
|
713 status
|
pankso@7
|
714 echo -n "Copying the receipt..."
|
pankso@7
|
715 cp -a $WOK/$pkg/receipt $dest/$pkg
|
pankso@7
|
716 status
|
pankso@7
|
717 if [ -d "$WOK/$pkg/stuff" ]; then
|
pankso@7
|
718 echo -n "Copying all the stuff directory..."
|
pankso@7
|
719 cp -a $WOK/$pkg/stuff $dest/$pkg
|
pankso@7
|
720 status
|
pankso@7
|
721 fi
|
pankso@7
|
722 done
|
pankso@7
|
723 echo "================================================================================"
|
pankso@7
|
724 echo "Clean wok generated in : $dest"
|
pankso@7
|
725 echo "Packages cleaned : `ls -1 $dest | wc -l`"
|
pankso@7
|
726 echo ""
|
pankso@7
|
727 ;;
|
pankso@7
|
728 clean-wok)
|
pankso@7
|
729 # Clean all packages in the work directory
|
pankso@7
|
730 #
|
pankso@7
|
731 for pkg in `ls -1 $WOK`
|
pankso@7
|
732 do
|
pankso@7
|
733 tazwok clean $pkg
|
pankso@7
|
734 done
|
pankso@7
|
735 echo "================================================================================"
|
pankso@7
|
736 echo "`ls -1 $WOK | wc -l` packages cleaned."
|
pankso@7
|
737 echo ""
|
pankso@7
|
738 ;;
|
pankso@7
|
739 gen-list)
|
pankso@7
|
740 # Sed is used to remove all the .tazpkg extensions from the
|
pankso@7
|
741 # packages.list. The directory to move in by default is the repository
|
pankso@28
|
742 # if $2 is not empty cd into $2. A text packages list can also be gen
|
pankso@28
|
743 # with the option --text.
|
pankso@7
|
744 #
|
pankso@28
|
745 if [ "$2" == "--text" ]; then
|
pankso@28
|
746 textlist="yes"
|
pankso@28
|
747 elif [ -z "$2" ]; then
|
pankso@7
|
748 PACKAGES_REPOSITORY=$PACKAGES_REPOSITORY
|
pankso@7
|
749 else
|
pankso@7
|
750 if [ -d "$2" ]; then
|
pankso@7
|
751 PACKAGES_REPOSITORY=$2
|
pankso@7
|
752 else
|
pankso@7
|
753 echo -e "\nUnable to find directory : $2\n"
|
pankso@7
|
754 exit 0
|
pankso@7
|
755 fi
|
pankso@7
|
756 fi
|
pankso@7
|
757 cd $PACKAGES_REPOSITORY
|
pankso@7
|
758 # Remove old packages.list and md5sum, it well be soon rebuild.
|
pankso@28
|
759 rm -f packages.list packages.md5 packages.txt
|
pankso@7
|
760 echo ""
|
pankso@28
|
761 echo -e "\033[1mGenerating packages lists\033[0m"
|
pankso@28
|
762 echo "================================================================================"
|
pankso@28
|
763 echo -n "Repository path : $PACKAGES_REPOSITORY" && status
|
pankso@28
|
764 # Gen packages.txt
|
pankso@28
|
765 if [ "$textlist" == "yes" ]; then
|
pankso@28
|
766 gen_textlist
|
pankso@28
|
767 fi
|
pankso@28
|
768 echo -n "Creating the raw packages list... "
|
pankso@17
|
769 ls -1 *.tazpkg > /tmp/packages.list
|
pankso@7
|
770 sed -i s/'.tazpkg'/''/ /tmp/packages.list
|
pankso@7
|
771 status
|
pankso@7
|
772 echo -n "Building the md5sum for all packages... "
|
pankso@7
|
773 md5sum * > packages.md5
|
pankso@7
|
774 status
|
pankso@7
|
775 mv /tmp/packages.list $PACKAGES_REPOSITORY
|
pankso@7
|
776 echo "================================================================================"
|
pankso@7
|
777 pkgs=`cat $PACKAGES_REPOSITORY/packages.list | wc -l`
|
pankso@7
|
778 echo "$pkgs packages in the repository."
|
pankso@7
|
779 echo ""
|
pankso@7
|
780 ;;
|
pankso@7
|
781 new-tree)
|
pankso@7
|
782 # Just creat a few directories and gen a empty receipt to prepare
|
pankso@7
|
783 # the creation of a new package.
|
pankso@7
|
784 #
|
pankso@7
|
785 check_for_package_on_cmdline
|
pankso@7
|
786 if [ -d $WOK/$PACKAGE ]; then
|
pankso@7
|
787 echo -e "\n$PACKAGE package tree already exist.\n"
|
pankso@7
|
788 exit 0
|
pankso@7
|
789 fi
|
pankso@7
|
790 echo "Creating : $WOK/$PACKAGE"
|
pankso@7
|
791 mkdir $WOK/$PACKAGE
|
pankso@7
|
792 cd $WOK/$PACKAGE
|
pankso@7
|
793 echo -n "Preparing the receipt..."
|
pankso@7
|
794 #
|
pankso@7
|
795 # Default receipt begin.
|
pankso@7
|
796 #
|
pankso@7
|
797 echo "# SliTaz package receipt." > receipt
|
pankso@7
|
798 echo "" >> receipt
|
pankso@7
|
799 echo "PACKAGE=\"$PACKAGE\"" >> receipt
|
pankso@7
|
800 # Finish the empty receipt.
|
pankso@7
|
801 cat >> receipt << "EOF"
|
pankso@7
|
802 VERSION=""
|
pankso@7
|
803 CATEGORY=""
|
pankso@7
|
804 SHORT_DESC=""
|
pankso@7
|
805 MAINTAINER=""
|
pankso@7
|
806 DEPENDS=""
|
pankso@7
|
807 TARBALL="$PACKAGE-$VERSION.tar.gz"
|
pankso@7
|
808 WEB_SITE=""
|
pankso@7
|
809 WGET_URL=""
|
pankso@7
|
810
|
pankso@7
|
811 # Rules to configure and make the package.
|
pankso@7
|
812 compile_rules()
|
pankso@7
|
813 {
|
pankso@7
|
814 cd $src
|
pankso@7
|
815 ./configure --prefix=/usr --infodir=/usr/share/info \
|
pankso@7
|
816 --mandir=/usr/share/man $CONFIGURE_ARGS
|
pankso@7
|
817 make
|
pankso@7
|
818 make DESTDIR=$PWD/_pkg install
|
pankso@7
|
819 }
|
pankso@7
|
820
|
pankso@7
|
821 # Rules to gen a SliTaz package suitable for Tazpkg.
|
pankso@7
|
822 genpkg_rules()
|
pankso@7
|
823 {
|
pankso@7
|
824 mkdir -p $fs/usr
|
pankso@7
|
825 cp -a $_pkg/usr/bin $fs/usr
|
pankso@7
|
826 strip -s $fs/usr/bin/*
|
pankso@7
|
827 }
|
pankso@7
|
828
|
pankso@7
|
829 EOF
|
pankso@7
|
830 #
|
pankso@7
|
831 # Default receipt end.
|
pankso@7
|
832 #
|
pankso@7
|
833 status
|
pankso@7
|
834 # Interactive mode, asking and seding.
|
pankso@7
|
835 if [ "$3" = "--interactive" ]; then
|
pankso@7
|
836 echo "Entering in interactive mode..."
|
pankso@7
|
837 echo "================================================================================"
|
pankso@7
|
838 echo "Package : $PACKAGE"
|
pankso@7
|
839 # Version.
|
pankso@7
|
840 echo -n "Version : " ; read anser
|
pankso@7
|
841 sed -i s/'VERSION=\"\"'/"VERSION=\"$anser\""/ receipt
|
pankso@7
|
842 # Category.
|
pankso@7
|
843 echo -n "Category : " ; read anser
|
pankso@7
|
844 sed -i s/'CATEGORY=\"\"'/"CATEGORY=\"$anser\""/ receipt
|
pankso@7
|
845 # Short description.
|
pankso@7
|
846 echo -n "Short desc : " ; read anser
|
pankso@7
|
847 sed -i s/'SHORT_DESC=\"\"'/"SHORT_DESC=\"$anser\""/ receipt
|
pankso@7
|
848 # Maintainer.
|
pankso@7
|
849 echo -n "Maintainer : " ; read anser
|
pankso@7
|
850 sed -i s/'MAINTAINER=\"\"'/"MAINTAINER=\"$anser\""/ receipt
|
pankso@7
|
851 # Web site.
|
pankso@7
|
852 echo -n "Web site : " ; read anser
|
pankso@7
|
853 sed -i s#'WEB_SITE=\"\"'#"WEB_SITE=\"$anser\""# receipt
|
pankso@7
|
854 echo ""
|
pankso@7
|
855 # Wget URL.
|
pankso@7
|
856 echo "Wget URL to download source tarball."
|
pankso@7
|
857 echo "Example : \$GNU_MIRROR/\$PACKAGE/\$TARBALL"
|
pankso@7
|
858 echo -n "Wget url : " ; read anser
|
pankso@7
|
859 sed -i s#'WGET_URL=\"\"'#"WGET_URL=\"$anser\""# receipt
|
pankso@7
|
860 # Ask for a stuff dir.
|
pankso@7
|
861 echo -n "Do you need a stuff directory ? (y/N) : " ; read anser
|
pankso@7
|
862 if [ "$anser" = "y" ]; then
|
pankso@7
|
863 echo -n "Creating the stuff directory..."
|
pankso@7
|
864 mkdir stuff && status
|
pankso@7
|
865 fi
|
pankso@7
|
866 # Ask for a description file.
|
pankso@7
|
867 echo -n "Are you going to write a description ? (y/N) : " ; read anser
|
pankso@7
|
868 if [ "$anser" = "y" ]; then
|
pankso@7
|
869 echo -n "Creating the description.txt file..."
|
pankso@7
|
870 echo "" > description.txt && status
|
pankso@7
|
871 fi
|
pankso@7
|
872 echo "================================================================================"
|
pankso@7
|
873 echo ""
|
pankso@7
|
874 fi
|
pankso@7
|
875 ;;
|
pankso@7
|
876 remove)
|
pankso@7
|
877 # Remove a package from the wok.
|
pankso@7
|
878 #
|
pankso@7
|
879 check_for_package_on_cmdline
|
pankso@7
|
880 echo ""
|
pankso@7
|
881 echo -n "Removing $PACKAGE..."
|
pankso@7
|
882 rm -rf $WOK/$PACKAGE && status
|
pankso@7
|
883 echo ""
|
pankso@7
|
884 ;;
|
pankso@7
|
885 usage|*)
|
pankso@7
|
886 # Print usage also for all unknow commands.
|
pankso@7
|
887 #
|
pankso@7
|
888 usage
|
pankso@7
|
889 ;;
|
pankso@7
|
890 esac
|
pankso@7
|
891
|
pankso@7
|
892 exit 0
|