tazpkg annotate modules/get @ rev 969

modules/get: continue fixing cookmode
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Nov 26 14:59:03 2018 +0200 (2018-11-26)
parents ed2904dae9f2
children f079c87ba419
rev   line source
al@844 1 #!/bin/sh
al@844 2 # TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg
al@844 3 # get - TazPkg module
al@844 4 # Get package to the cache directory
al@844 5
al@844 6
al@844 7 # 1. "Plain packages" - compiled and packed on cook.slitaz.org using receipts.
al@844 8 #
al@844 9 # Recently added other type of packages: packages that can't be compiled due to the closed sources
al@844 10 # or due to the giant size of that sources. In this case special script: a) downloads package
al@844 11 # compiled for other Linux from official web site, b) converts this package to the TazPkg format,
al@844 12 # c) installs this package as "plain" package.
al@844 13 #
al@844 14 # 2. "Get-packages" - package contains only one special script for downloading/converting.
al@844 15 # Sometimes get-package can get some specified version of the package, sometimes - different
al@844 16 # (latest) version.
al@844 17 #
al@844 18 # Packages 1. and 2. can be found in the wok repository: http://hg.slitaz.org/wok/
al@844 19 #
al@844 20 # 3. "Extra" get-scripts. Next addition - only script, without packaging.
al@844 21 # Extra get-scripts repository: http://hg.slitaz.org/get-scripts/
al@844 22 # Extra get-scripts mirror: http://mirror.slitaz.org/packages/get/
al@844 23 #
al@844 24 # 4. Converted "extra" packages. Next addition - some packages like LibreOffice / OpenOffice are
al@844 25 # big to compile them like _1. "Plain packages"_ as well as big to convert them on the user side
al@844 26 # (you need a lot of time, CPU, and RAM) and sometimes it is unable on the weak user machines.
al@844 27 # So, some selected and free packages are converted on the SliTaz server side, packaged and
al@844 28 # are ready to download by any user: http://mirror.slitaz.org/packages/extra/
al@844 29 #
al@844 30 #
al@844 31 # Algorithm to get package:
al@844 32 # - search package in question in the mirrored packages list, download if exists;
al@844 33 # - search "get-package" in the mirrored packages list, download if exists;
al@844 34 # - search package in the "extra" get-scripts list, download if exists and run it, get the package.
al@844 35 #
al@844 36 # Note, here doubling. Imagine, you may wanted "palemoon" package.
al@844 37 # 1. No "plain package";
al@844 38 # 2. Existing "get-palemoon" package;
al@844 39 # 3. Existing "palemoon" extra get-script;
al@844 40 # 4. Existing "palemoon" extra converted package.
al@844 41 # User will get 2. He can specify "--extra" option to get 3.
al@844 42 # FIXME: do something with doubling.
al@844 43
al@844 44
al@844 45
al@844 46
al@844 47 # Connect function libraries
al@844 48 . /lib/libtaz.sh
al@844 49 . /usr/lib/slitaz/libpkg.sh
al@844 50
al@844 51 # Get TazPkg working environment
al@844 52 . @@MODULES@@/getenv
al@844 53
al@844 54 . @@MODULES@@/find-depends
al@844 55
al@844 56
al@844 57
al@844 58
al@844 59 # Get cache directory path
al@844 60
al@844 61 get_cache_path() {
al@844 62 # input: $1 = DB folder such as "$PKGS_DB" or "$PKGS_DB/undigest/*"
al@844 63 # $2 (optional): 'extra' for cache for extra-package scripts
al@844 64 # output: path to cache directory
al@844 65
al@844 66 local cache_dir
al@844 67
al@844 68 if [ "$2" == 'extra' ]; then
al@844 69 cache_dir="$SAVE_CACHE_DIR/extra/packages"
al@844 70 elif [ "$1" == "$PKGS_DB" ]; then
al@844 71 # Main repository
al@844 72 cache_dir="$SAVE_CACHE_DIR/$SLITAZ_RELEASE/packages"
al@844 73 else
al@844 74 # Undigest repository
al@844 75 cache_dir="$SAVE_CACHE_DIR/${1##*/}/packages"
al@844 76 fi
al@844 77
al@844 78 # Make cache directory if absent
al@844 79 mkdir -p "$cache_dir"
al@844 80 chmod a+w "$cache_dir"
al@844 81
al@844 82 echo "$cache_dir"
al@844 83 }
al@844 84
al@844 85
al@844 86 # Download a file from mirror
al@844 87
al@844 88 download_from() {
al@844 89 # input: "<mirror_url>" "<package_name>-<version>.tazpkg"
al@844 90
al@844 91 debug "\ndownload_from('$1', '$2')"
al@844 92
al@844 93 case "$1" in
al@844 94 # Mirror URL can have a trailing slash or not.
al@844 95 http://* | https://* | ftp://*)
al@862 96 debug " wget -c -T 30 -U $UA ${1%/}/$2"
al@877 97 q=''; [ -n "$quiet" ] && q='-q'
al@864 98 # Display abridged wget status (skip info about connections)
al@937 99 wget -c $q -T 30 -U $UA ${1%/}/$2 2>&1 | awk '$0~"%"{printf "%s\r",$0}' >&2
al@844 100 ;;
al@844 101 *)
al@863 102 debug " cp ${1%/}/$2 ."
al@863 103 cp ${1%/}/$2 .;;
al@844 104 esac
al@844 105 }
al@844 106
al@844 107
al@844 108 # This function may be called by a get script.
al@844 109
al@844 110 abort_package() {
al@844 111 cd "$CUR_DIR"
al@844 112 rm -rf "$tmp_dir"
pascal@911 113 [ -n "$1" ] ||
pascal@911 114 set -- 'Could not download "%s" from "%s". Exiting.' "${TARBALL:-$PACKAGE}" "${WGET_URL:-$WEB_SITE}"
pascal@911 115 printf "$@"
al@844 116 exit 1
al@844 117 }
al@844 118
al@844 119
al@844 120 # Get extra-package file to the cache
al@844 121
al@844 122 get_pkg_extra() {
al@844 123 # input: $1 extra-package name (like 'dropbox')
al@844 124 # $2 (internal): empty or 'redo' (when recursive calling)
al@844 125 # action: download stuff and make package
al@844 126 # output: full path to created package
al@844 127
al@844 128 debug "\nget_pkg_extra('$1', '$2')"
al@844 129
al@844 130 local mirror extra_cache converted tmp_dir script
al@844 131
al@844 132 # Check extra.list
al@844 133 if [ ! -s "$PKGS_DB/extra.list" ]; then
al@844 134 # Empty extra.list
al@844 135 if [ "$2" != 'redo' ]; then
al@844 136 tazpkg recharge >&2
al@844 137 get_pkg_extra "$1" 'redo'; exit 0
al@844 138 else
al@844 139 # Give up
al@844 140 _ 'File "%s" empty.' 'extra.list' >&2
al@844 141 die 'Unable to find package "%s" in the extra packages list.' "$(boldify $1)"
al@844 142 fi
al@844 143 fi
al@844 144
al@844 145 # Extra.list exists and not empty
al@844 146 if ! grep -q "^$1|" "$PKGS_DB/extra.list"; then
al@844 147 die 'Unable to find package "%s" in the extra packages list.' "$(boldify $1)"
al@844 148 fi
al@844 149
al@844 150 # Extra-package found in extra.list
al@844 151
al@844 152 if [ -z "$nocache" ]; then
al@844 153 # Go to cache for "get-install" command; don't move for "get" command
al@844 154 extra_cache="$(get_cache_path "$PKGS_DB" 'extra')"
al@844 155 debug "cd '$extra_cache'"
al@844 156 cd "$extra_cache"
al@844 157
al@844 158 # Extra-cache should contain packages DB files (packages.info, etc.)
al@844 159 # to list extra-packages contained in the extra-cache
al@968 160 [ ! -e 'packages.info' -a ! -e "packages-$SLITAZ_ARCH.info" ] &&
al@968 161 tazpkg mkdb "$extra_cache" --root='' --forced >/dev/null
al@844 162
al@968 163 pi='packages.info'
al@968 164 [ -e "$pi" ] || pi="packages-$SLITAZ_ARCH.info"
al@968 165
al@968 166 if [ -e "$pi" ]; then
al@968 167 awk -F$'\t' -vp="$1" '$1==p{exit 1}' $pi
al@844 168 if [ "$?" -eq 1 ]; then
al@876 169 [ -z "$quiet" ] && _ 'Package "%s" already in the cache' "$1" >&2
al@844 170 echo -n "$(pwd)/"
al@968 171 awk -F$'\t' -vp="$1" '$1==p{printf "%s-%s.tazpkg\n", $1, $2; exit}' $pi
al@844 172 exit 0
al@844 173 fi
al@844 174 fi
al@844 175 fi
al@844 176
al@844 177 mirror="$(cat "$PKGS_DB/mirror")"
al@844 178 debug "mirror='$mirror'"
al@844 179
al@844 180
al@844 181 # Try converted extra-packages first
al@844 182 # FIXME: Workaround to get packages filenames (even better to have names and versions separate)
al@846 183 converted="$(wget -O - http://mirror1.slitaz.org/packages/extra/ 2>/dev/null | \
al@844 184 tr \'\" $'\n' | grep "$1-.*\.tazpkg$" | sort -u)"
al@844 185 debug "converted='$converted'"
al@844 186 if [ -n "$converted" ]; then
al@844 187 case "$mirror" in
al@844 188 http://*|https://*|ftp://*)
al@844 189 # Default 'http://mirror.slitaz.org/packages/cooking/'
al@844 190 # -> 'http://mirror.slitaz.org/packages/extra/'
al@862 191 debug "wget -T 30 -U '$UA' '${mirror%packages/*}packages/extra/$converted'"
al@877 192 q=''; [ -n "$quiet" ] && q='-q'
al@877 193 wget $q -T 30 -U "$UA" "${mirror%packages/*}packages/extra/$converted" \
al@938 194 2>&1 | awk '$0~"%"{printf "%s\r",$0}' >&2;;
al@844 195 esac
al@844 196 if [ -f "$converted" ]; then
al@844 197 echo "$extra_cache/$converted"; exit 0
al@844 198 fi
al@844 199 fi
al@844 200
al@844 201
al@844 202 # Fails to download converted extra-package; now try to download and execute get-script
al@844 203 cd ..
al@844 204 case "$mirror" in
al@844 205 http://*|https://*|ftp://*)
al@844 206 # Default 'http://mirror.slitaz.org/packages/cooking/'
al@844 207 # -> 'http://mirror.slitaz.org/packages/get/'
al@862 208 debug "wget -T 30 -U '$UA' '${mirror%packages/*}packages/get/$1'"
al@877 209 q=''; [ -n "$quiet" ] && q='-q'
al@877 210 wget $q -T 30 -U "$UA" "${mirror%packages/*}packages/get/$1" \
al@938 211 2>&1 | awk '$0~"%"{printf "%s\r",$0}' >&2;;
al@844 212 esac
al@844 213
al@844 214 if [ ! -f "$1" ]; then
al@844 215 # TODO: extra package or extra package script? :) Too complicated...
al@844 216 die 'Unable to download extra package "%s".' "$(boldify $1)"
al@844 217 fi
al@844 218
al@844 219 # Extra-package script downloaded in the /var/cache/tazpkg/extra/
al@844 220
al@844 221 unset_receipt
al@844 222 PACKAGE="$1"
al@844 223 script="$(realpath $1)"
al@844 224 tmp_dir="$(mktemp -d)"; cd "$tmp_dir"
al@844 225 # Run script
al@844 226 set -e
al@844 227 . "$script"
al@844 228 set +e
al@844 229
pascal@918 230 [ "$PWD" != "$tmp_dir" ] && mv $PACKAGE* $tmp_dir
pascal@918 231 cd $tmp_dir
pascal@918 232 [ -n "$VERSION" ] || VERSION="$(date +%Y%m%d)"
pascal@918 233 [ -d "$PACKAGE-$VERSION" ] || mv $PACKAGE $PACKAGE-$VERSION || abort_package
pascal@918 234 [ -n "$TARBALL" ] || TARBALL="$(basename $WGET_URL)"
al@844 235
al@844 236 if [ ! -s "$PACKAGE-$VERSION/receipt" ]; then
al@844 237 # Create receipt (if script not created it early) using variables from script
al@844 238 cat > "$PACKAGE-$VERSION/receipt" <<EOT
al@844 239 # SliTaz package receipt.
al@844 240
al@844 241 PACKAGE="$PACKAGE"
pascal@918 242 VERSION="$VERSION"
al@844 243 CATEGORY="${CATEGORY:-non-free}"
pascal@919 244 WEB_SITE="${WEB_SITE:-$WEBSITE}"
pascal@918 245 SHORT_DESC="${SHORT_DESC:-The $PACKAGE software package of SliTaz}"
al@844 246 MAINTAINER="${MAINTAINER:-nobody@slitaz.org}"
pascal@912 247 LICENSE="${LICENSE:-unknown}"
pascal@918 248 TARBALL="$TARBALL"
pascal@919 249 WGET_URL="${WGET_URL:-$WGETURL}"
al@844 250 CONFIG_FILES="$CONFIG_FILES"
al@844 251 SUGGESTED="$SUGGESTED"
al@844 252 PROVIDE="$PROVIDE"
al@844 253 DEPENDS="$DEPENDS"
al@844 254 HOST_ARCH="$HOST_ARCH"
al@844 255 TAGS="$TAGS"
al@844 256 EXTRA_SOURCE_FILES="$EXTRA_SOURCE_FILES"
al@844 257 EOT
al@844 258 fi
al@844 259
al@844 260 # Add dependencies which was found to already defined dependencies
al@950 261 DEPENDS="$(unset DEPENDS; . ./$PACKAGE-$VERSION/receipt; echo $DEPENDS)"
al@898 262 TMP_DIR="$tmp_dir"
al@844 263 for i in $(find_depends "$PACKAGE-$VERSION/fs"); do
al@844 264 case " $DEPENDS " in
al@844 265 *\ $i\ *) continue;;
al@844 266 esac
al@844 267 sed -i "s/^DEPENDS=\"/&$i /" "$PACKAGE-$VERSION/receipt"
al@844 268 done
al@844 269
al@844 270 # Remove empty variables
al@844 271 sed -i '/=""$/d' "$PACKAGE-$VERSION/receipt"
al@844 272
al@844 273 tazpkg pack "$PACKAGE-$VERSION" gzip >&2
al@844 274
al@844 275 if [ -z "nocache" ]; then
al@844 276 # move package to the extra-cache for "get-install" command
al@844 277 mv -f "$tmp_dir/$PACKAGE-$VERSION.tazpkg" "$extra_cache"
al@844 278 # Re-make extra packages database
al@844 279 tazpkg mkdb "$extra_cache" --root='' --forced >/dev/null
al@844 280 else
al@844 281 # move package to directory where "tazpkg get" command invoked
al@844 282 mv -f "$tmp_dir/$PACKAGE-$VERSION.tazpkg" "$CUR_DIR"
al@844 283 fi
al@844 284
al@844 285 # Clean
al@844 286 rm -rf "$tmp_dir"
al@844 287
al@844 288 # Function output: path to package
al@844 289 echo "$CUR_DIR/$PACKAGE-$VERSION.tazpkg"
al@844 290 }
al@844 291
al@844 292
pascal@873 293 # return possible name for a virtual package name
pascal@873 294
pascal@922 295 virtual_name() {
pascal@873 296 # input: $1 virtual package name
pascal@873 297 # $2 repository db directory
pascal@873 298 local i
al@887 299 unset IFS
pascal@873 300 for i in $(grep -hs "^$1=" "$2/packages.equiv" | sed "s/^$1=//"); do
pascal@873 301 if echo $i | fgrep -q : ; then
pascal@873 302 # format 'alternative:newname'
pascal@873 303 # if alternative is installed then substitute newname
pascal@874 304 if [ -f $INSTALLED/${i%:*}/receipt ]; then
pascal@873 305 # substitute package dependency
pascal@873 306 echo ${i#*:}
pascal@873 307 return
pascal@873 308 fi
al@887 309 elif ! grep -q "^$1 " "$2/packages.info" || [ -f "$INSTALLED/$i/receipt" ]; then
pascal@873 310 # unconditional substitution
pascal@873 311 echo $i
pascal@873 312 return
pascal@873 313 fi
pascal@873 314 done
pascal@879 315 # the real package name
pascal@879 316 echo $1
pascal@873 317 }
pascal@873 318
pascal@922 319 virtual_pkg() {
pascal@922 320 # input: $1 virtual package name
pascal@922 321 # $2 repository db directory
pascal@922 322 # output: display possible package name
pascal@922 323
pascal@922 324 debug "\nvirtual_pkg('$1', '$2')"
pascal@922 325
pascal@922 326 if [ "$tazpkg_command" != 'get-install' ]; then
pascal@922 327 # 'get' command: download any package
pascal@922 328 if [ -z "$(awk -F$'\t' -vp="$1" '{if ($1 == p) print p}' "$2/packages.info")" ]; then
paul@923 329 # This package does not exist in the list, it may be a virtual package
pascal@922 330 virtual_name "$1" "$2"
pascal@922 331 else
pascal@922 332 echo $1
pascal@922 333 fi
pascal@922 334 return
pascal@922 335 fi
pascal@922 336
pascal@922 337 virtual_name "$1" "$2"
pascal@922 338 }
pascal@922 339
al@887 340
al@844 341 # Download package file to the cache
al@844 342
al@844 343 get_pkg() {
al@844 344 # input: $1 package name either "name" or "name-version"
al@844 345 # $2 (internal): empty or 'redo' (when recursive calling)
al@844 346 # action: download package from mirror to the cache directory
al@844 347 # output: full path to the downloaded package
al@844 348
al@844 349 debug "\nget_pkg('$1', '$2')"
al@969 350 local repo line namever pkgsum pkgfile pi
al@844 351
al@844 352 IFS=$'\n'
al@844 353 for rep in $PRIORITY; do
al@968 354 pi="$rep/packages.info"
al@968 355 [ ! -e "$pi" ] && pi="$rep/packages-$SLITAZ_ARCH.info"
al@968 356 [ ! -e "$pi" ] && continue
al@968 357
al@949 358 # If found, output string "<name>-<ver>"
al@949 359 namever=$(awk -F$'\t' -vpkg="$(virtual_pkg "$1" "$rep")" \
al@968 360 '$1==pkg || $1"-"$2==pkg {printf "%s-%s", $1, $2; exit}' "$pi")
al@965 361
al@969 362 pkgfile="$namever-$SLITAZ_ARCH.tazpkg"
al@969 363 [ -e "$pkgfile" ] ||
al@969 364 pkgfile="$namever-any.tazpkg"
al@965 365
al@949 366 if [ -n "$namever" ]; then
al@965 367 pkgsum=$(awk -vfile="$pkgfile" '{if($2==file)print $1}' $rep/packages.md5)
al@844 368 break
al@844 369 fi
al@844 370 done
al@844 371 unset IFS
al@844 372
al@965 373 debug " rep='$rep'\n namever='$namever'\n pkgfile='$pkgfile'\n pkgsum='$pkgsum'"
al@844 374
al@949 375 if [ -z "$namever" ]; then
al@889 376 _ 'Unable to find package "%s" in the mirrored packages list.' "$1" >&2
al@844 377 # Retry with "get-package"; prevent looping with 'redo'
al@844 378 if [ "$2" != 'redo' ]; then
al@844 379 get_pkg "get-$1" 'redo'; exit 0
al@844 380 else
al@844 381 # Retry with extra-package
al@844 382 get_pkg_extra "${1#get-}"
al@844 383 exit 0
al@844 384 fi
al@844 385 fi
al@844 386
al@965 387 # We need package "$pkgfile" from "$rep" with "$pkgsum"
al@844 388
al@844 389 if [ -z "$nocache" ]; then
al@844 390 # Go to cache for "get-install" command; don't move for "get" command
al@844 391 debug "cd '$(get_cache_path "$rep")'"
al@844 392 cd "$(get_cache_path "$rep")"
al@844 393 fi
al@844 394
al@844 395 # Check if package already downloaded
al@965 396 if [ -f "$pkgfile" ]; then
al@876 397 [ -z "$nocache" -a -z "$quiet" ] && _ 'Package "%s" already in the cache' "$namever" >&2
al@844 398
paul@943 399 # Check if downloading complete, resume if not complete
al@965 400 if ! tail -c 2k "$pkgfile" | fgrep -q '00000000TRAILER'; then
al@876 401 [ -z "$quiet" ] && _ 'Continuing package "%s" download' "$namever" >&2
al@965 402 download_from "$(cat "$rep/mirror")" "$pkgfile"
al@844 403 fi
al@844 404 else
al@844 405 # Package absent in the cache, "cold" downloading
al@965 406 download_from "$(cat "$rep/mirror")" "$pkgfile"
al@844 407 fi
al@844 408
al@844 409 # Make sure we downloaded what we want with checksum
al@844 410
al@965 411 if [ "$($CHECKSUM "$pkgfile" | cut -d' ' -f1)" != "$pkgsum" ]; then
al@965 412 _ 'Checksum error for "%s"' "$pkgfile" >&2
al@965 413 rm "$pkgfile"
al@844 414
al@844 415 # Recharge DBs and try again; prevent looping with 'redo'
al@844 416 if [ "$2" != 'redo' ]; then
al@844 417 tazpkg recharge >&2
al@844 418 get_pkg "$1" 'redo'; exit 0
al@844 419 else
al@844 420 # Give up
al@844 421 # TODO: try another mirror?
al@844 422 die 'Please wait until the mirror synchronization is complete and try again.'
al@844 423 fi
al@844 424 fi
al@844 425
al@844 426 # Output: path to downloaded package
al@965 427 printf '%s/%s\n' "$(pwd)" "$pkgfile"
al@844 428 }
al@844 429
al@844 430
al@941 431 # Get local package from /home/slitaz/packages to co-work with the cookutils
al@941 432
al@941 433 get_pkg_cookmode() {
al@941 434 # input: $1 package name (like 'advancecomp')
al@941 435 # action: find package in /home/slitaz/packages (or where defined in the cook.conf)
al@941 436 # output: full path to the found package
al@941 437 # ROOT NOT USED
al@941 438
al@941 439 local PKGS='/home/slitaz/packages' found='0'
al@950 440 [ -e "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
al@941 441
al@941 442 # Find local package
al@968 443 pi="$PKGS/packages.info"
al@968 444 [ -e "$pi" ] || pi="$PKGS/packages-$SLITAZ_ARCH.info"
al@968 445
al@957 446 namever="$(awk -F$'\t' -vpkg="$1" '{
al@957 447 if ($1 == pkg) { printf("%s-%s", $1, $2); exit; }
al@968 448 }' $pi)"
al@941 449
al@946 450 # Find local provided package
al@957 451 [ -n "$namever" ] ||
al@957 452 namever="$(awk -F$'\t' -vpkg="$1" '{
al@957 453 if (index(" " $10 " ", " " pkg " ")) { printf("%s-%s", $1, $2); exit; }
al@968 454 }' $pi)"
al@941 455
al@969 456 if [ -n "$namever" ]; then
al@969 457 pkgfile=$(find "$PKGS" -name "$namever-$SLITAZ_ARCH.tazpkg")
al@969 458 [ -n "$pkgfile" ] ||
al@969 459 pkgfile=$(find "$PKGS" -name "$namever-any.tazpkg")
al@969 460 fi
al@957 461
al@948 462 if [ -n "$pkgfile" -a -f "$pkgfile" ]; then
al@946 463 echo "$pkgfile"
al@946 464 else
al@946 465 # Proceed to get package as usual (non-local)
al@941 466 get_pkg "$1"
al@941 467 fi
al@941 468 }
al@941 469
al@941 470
al@844 471
al@844 472
al@864 473 # Command 'get-install' calls 'get', then 'install' modules. Check package presence here, on the
al@864 474 # first stage, if '--forced' option not given
al@866 475 if [ "$tazpkg_command" == 'get-install' ]; then
al@866 476 if grep -qs "^$1$" "$BLOCKED"; then
al@866 477 _ 'Package "%s" blocked.' "$1" >&2
al@864 478 exit 1
al@864 479 fi
al@866 480
al@866 481 if [ -z "$forced" ]; then
al@866 482 awk -F$'\t' -vpv="$1" '$1==pv { exit 1 }' "$PKGS_DB/installed.info"
al@866 483 if [ "$?" -eq 1 ]; then
al@880 484 [ -z "$quiet" ] && (
al@866 485 newline
al@866 486 _ '"%s" package is already installed.' "$(colorize 34 "$1")"
al@866 487 longline "$(_ 'You can use the --forced option to force installation.')"
al@866 488 newline
al@866 489 ) >&2
al@866 490 # Prevent execution 'install' stage:
al@866 491 exit 1
al@866 492 fi
al@866 493 fi
al@864 494 fi
al@864 495
al@941 496 if [ -n "$cookmode" ]; then
al@941 497 # When '--cookmode' option given, try to find package in the local cook repository,
al@941 498 # then, if fails, try to get the package as usual
al@941 499 get_pkg_cookmode "$1"
al@941 500 elif [ -n "$extra" ]; then
al@844 501 # When '--extra' option given, extra-package has priority over 'regular' packages
al@844 502 get_pkg_extra "$1"
al@844 503 else
al@844 504 # Try to get 'package', then 'get-package', then extra 'package'
al@844 505 get_pkg "$1"
al@844 506 fi