tazwok annotate tazwok @ rev 74

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