#!/bin/bash ################################################## # Imports ################################################## . ScriptFunctions Import OptionParser Import File Import GoboLinux Import Compile ################################################## # Options and configuration ################################################## Parse_Conf Compile.conf scriptDescription="Update local recipe list from recipe stores." scriptCredits="(C) 2003-2004 Carlo Calica et al. Released under the GNU GPL." scriptUsage="[]" scriptNotes="When updating a single program, $scriptName will download "\ "all its available recipes. When no program is specified, $scriptName will "\ "fetch the recipe list and populate $compileGetRecipeDir with directory "\ "entries (and download the recipes only if --all is used)." Add_Option_Boolean "a" "all" "Download contents of updated recipes. "\ "By default, $scriptName will only fetch the recipe list and generate "\ "empty recipe directories (except when updating a single program)." Add_Option_Boolean "l" "all-latest" "Like --all, but only fetch the latest "\ "versions of each recipe." Add_Option_Boolean "t" "thorough" "Check all availabe mirrors for updates. "\ "By default, only the first working mirror (as configured in Compile.conf) is used." Parse_Options "$@" if Is_Writable "$compileGetRecipeDir" then sudo= else sudo="sudo -u #0" fi ################################################## # Prepare Environment ################################################## Check_Dir_Variable compileGetRecipeDir ################################################## # Operation ################################################## app="$(Arg 1)" function get_recipes_for_app() { for recipe in `FindPackage --types=recipe --full-list $1` do #[detsch], getrecipe now receives a full url/path GetRecipe "$recipe" > /dev/null done } if [ "$app" ] then get_recipes_for_app "$app" else for getRecipeStoreHttp in "${getRecipeStores[@]}" do lsfile="$getRecipeStoreHttp/RecipeList" Log_Normal "Updating recipes from store $getRecipeStoreHttp" tmpls=$(wget $lsfile -O - 2>/dev/null) for recipename in ${tmpls} do noext="$recipename" noext=${noext%--recipe.tar.bz2} packagename=${noext%--*} packageversion=${noext##*--} recipeurl="$getRecipeStoreHttp/$recipename" if Boolean "all" then # getrecipe GetRecipe "$recipeurl" > /dev/null elif Boolean "all-latest" then if [ `FindPackage --type recipe $packagename 2> /dev/null` = "$recipeurl" ] then GetRecipe "$recipeurl" > /dev/null fi else # only create stub directory $sudo mkdir -p "$compileGetRecipeDir/$packagename/$packageversion" fi done if [ "$?" == "0" ] && ! Boolean "thorough" then break 2 fi done fi