diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/simplaret | 70 |
1 files changed, 48 insertions, 22 deletions
diff --git a/src/simplaret b/src/simplaret index 2a5498d..d892a2b 100755 --- a/src/simplaret +++ b/src/simplaret @@ -20,7 +20,6 @@ DEFAULT_VERSION="11.0" SIMPLARET_CONF="/etc/simplepkg/simplepkg.conf" REPOS_CONF="/etc/simplepkg/repos.conf" COMMON="/usr/libexec/simplepkg/common.sh" -FILELIST="FILELIST.TXT CHECKSUMS.md5" function simplaret_usage { @@ -61,7 +60,7 @@ function simplaret_eval_config { function simplaret_get_index { - for file in $FILELIST; do + for file in `simplaret_metafiles`; do simplaret_download $1 $file $2 done @@ -69,7 +68,7 @@ function simplaret_get_index { function simplaret_backup_index { - for file in $FILELIST; do + for file in `simplaret_metafiles`; do if [ -f "$1/$file" ]; then mv $1/$file $1/$file.old fi @@ -79,7 +78,7 @@ function simplaret_backup_index { function simplaret_check_index { - for file in $FILELIST; do + for file in `simplaret_metafiles`; do if [ ! -f "$1/$file" ] && [ -f "$1/$file" ]; then echo restoring old $file to $1... mv $1/$file.old $1/$file @@ -226,10 +225,10 @@ function simplaret_update { function simplaret_find_package { - # grep packages in a repository's FILELIST.TXT + # grep packages in a repository's file list # usage: simplaret_find_package <package-name> <repository-folder> - grep $1 $2/FILELIST.TXT | awk '{ print $8 }' | grep -e ".tgz$" + grep $1 $2/`simplaret_filelist` | awk '{ print $8 }' | grep -e ".tgz$" } @@ -258,6 +257,22 @@ function simplaret_show_package { } +function simplaret_filelist { + + if [ "$repos_type" == "patches" ]; then + echo FILE_LIST + else + echo FILELIST.TXT + fi + +} + +function simplaret_metafiles { + + echo `simplaret_filelist` CHECKSUMS.md5 + +} + function simplaret_search { local priority message @@ -271,7 +286,7 @@ function simplaret_search { simplaret_repository_name - if [ ! -f "$storage/$repository_name/FILELIST.TXT" ]; then + if [ ! -f "$storage/$repository_name/`simplaret_filelist`" ]; then if [ "$WARNING" != "0" ] || [ ! -z "$SILENT" ]; then if [ "$repos_type" == "noarch" ]; then message="" @@ -403,6 +418,30 @@ function simplaret_get { } +function simplaret_get_jail_patches { + + # get patches from a jail + # usage: simplaret_get_jail_patches <jail-folder> + + # TODO: + # - pega a arquitetura e a versao da jaula + # - verifica os patches disponiveis para aquela arquitetura e versao + # - caso haja na jaula um pacote instalado cujo patch estah disponivel, baixa-o + + local root oldarch oldversion + root="$1" + + oldarch="$ARCH" + oldversion="$VERSION" + + VERSION="`cat $root/etc/slackware-version | awk '{ print $2 }' | sed -e 's/.0$//'`" + ARCH="`cat $root/etc/slackware-version | awk '{ print $3 }' | sed -e 's/(//' -e 's/)//'`" + + ARCH="$oldarch" + VERSION="$oldversion" + +} + function simplaret_get_patches { if [ ! -d "$PATCHES_DIR/$ARCH/$VERSION" ]; then @@ -410,24 +449,11 @@ function simplaret_get_patches { fi # TODO: new format - # primeiro checa por atualizacoes na instalacao principal - # - depois olha a lista de jaulas por /etc/simplepkg/jailist - # - pega a arquitetura e a versao da jaula - # - verifica os patches disponiveis para aquela arquitetura e versao - # - caso haja na jaula um pacote instalado cujo patch estah disponivel, baixa-o + # chama o simplaret_get_jail_patches, primeiro para a instalacao principal + # e depois para as jaulas do /etc/simplepkg/jailist echo fetching patches for arch $ARCH and version $VERSION... - # check for downloaded patches - for patch in `ls $PATCHES_DIR/$ARCH/$VERSION/*tgz 2> /dev/null`; do - file="`find $STORAGE/$ARCH/$VERSION/ -name $patch 2> /dev/null`" - if [ ! -f "$file" ]; then - rm $patch - else - ln -sf $file $PATCHES_DIR/$ARCH/$VERSION/ - fi - done - # grab new patches for patch in `simplaret_search patches -basename_only`; do simplaret --get `package_name $patch` |