#!/bin/bash # $HeadURL$ $LastChangedRevision$ # Properties MY_ID=system_repo PARENT_ID=system MY_PRIVATE_ATTRIBUTES="uname status" MY_PUBLIC_ATTRIBUTES= MY_ATTRIBUTES="$MY_PRIVATE_ATTRIBUTES $MY_PUBLIC_ATTRIBUTES" MY_HELPER_IDS= # Attributes for MY_ATTRIBUTE in ${MY_ATTRIBUTES^^}; do eval "$MY_ATTRIBUTE="; done # Defaults for the questions we ask (should only used here) # Hooks list_prologue() { # my properties inherit MY_ID # real locals local UNAME UNAMES # globals inherit SQLITE_CMD DB_FILE echo "repo indirects" echo "==============" echo UNAMES=$($SQLITE_CMD $DB_FILE "select group_concat(uname,' ') from attribute_values where helper == '$MY_ID' and attribute == 'status' and value == 'installing';") for UNAME in $UNAMES; do debug 10 "list_prologue: listing indirects for $UNAME ..." paa listhosts $UNAME paa listindirects $UNAME paa listshares $UNAME done echo return 0 } create_prologue() { # my attributes inherit ${MY_ATTRIBUTES^^} # my inherited attributes that i'll use inherit ARCH RELEASE # globals inherit VAR_DIR # real locals local CMDLINE info "creating repo indirects and shares ..." # For things that exist already, it's necessary to delete stuff first. paa --force unshare ALL-REPOS $UNAME > /dev/null 2>&1 || true paa --force unindirect ALL-REPOS $UNAME > /dev/null 2>&1 || true paa unhost $UNAME > /dev/null 2>&1 || true paa host $UNAME deb debian $RELEASE $ARCH || { error "paa host: failed"; return 1; } paa indirect ALL-REPOS $UNAME NEWEST-FREEZE || { error "paa indirect: failed"; return 1; } paa share ALL-REPOS $UNAME || { error "paa share: failed"; return 1; } return 0 } delete_prologue() { # my properties inherit MY_ID # my attributes inherit ${MY_ATTRIBUTES^^} # my inherited attributes that i'll use inherit ARCH RELEASE # globals inherit VAR_DIR # real locals local CMDLINE # Don't delete repo configs if installation completed successfully. [ "X$RELEASER_FLAG" != Xtrue ] || return 0 info "deleting repo shares and indirects ..." # Since paa will cause an error if it tries to delete something which does not exist, and # it is illegal for delete functions to fail, we must make a check first. COUNT=$($SQLITE_CMD $DB_FILE "select count(*) from attribute_values where helper == '$MY_ID' and attribute == 'status' and value == 'installing';") if [ $COUNT != 0 ]; then paa --force unshare ALL-REPOS $UNAME || { error "paa unshare: failed"; return 1; } paa --force unindirect ALL-REPOS $UNAME || { error "paa unindirect: failed"; return 1; } paa unhost $UNAME || { error "paa unhost: failed"; return 1; } fi return 0 }