tazwok annotate tazwok @ rev 77

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