diff --git a/general.sh b/general.sh index d5aeea09de..ff7a96a3e2 100644 --- a/general.sh +++ b/general.sh @@ -184,7 +184,7 @@ display_alert() #-------------------------------------------------------------------------------------------------------------------------------- { # log function parameters to install.log - echo "Displaying message: $@" >> $DEST/debug/output.log + [[ -n $DEST ]] && echo "Displaying message: $@" >> $DEST/debug/output.log local tmp="" [[ -n $2 ]] && tmp="[\e[0;33m $2 \x1B[0m]" @@ -258,8 +258,9 @@ addtorepo() # parameter "remove" dumps all and creates new # function: cycle trough distributions local distributions=("wheezy" "jessie" "trusty" "xenial") - + for release in "${distributions[@]}"; do + # let's drop from publish if exits if [[ -n $(aptly publish list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $release) ]]; then aptly publish drop -config=config/aptly.conf $release > /dev/null 2>&1 @@ -272,24 +273,49 @@ addtorepo() aptly db cleanup -config=config/aptly.conf > /dev/null 2>&1 fi - # create repository if not exist + if [[ $1 == replace ]]; then + local replace=true + else + local replace=false + fi + + # create local repository if not exist if [[ -z $(aptly repo list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $release) ]]; then display_alert "Creating section" "$release" "info" - aptly repo create -config=config/aptly.conf -distribution=$release -component=main -comment="Armbian stable" $release > /dev/null 2>&1 + aptly repo create -config=config/aptly.conf -distribution=$release -component="main" -comment="Armbian main repository" $release + fi + if [[ -z $(aptly repo list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $release"-utils") ]]; then + aptly repo create -config=config/aptly.conf -distribution=$release -component="utils" -comment="Armbian utilities" "$release"-utils + fi + if [[ -z $(aptly repo list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $release"-desktop") ]]; then + aptly repo create -config=config/aptly.conf -distribution=$release -component="desktop" -comment="Armbian desktop" "$release"-desktop + fi + # create local repository if not exist + + # adding main + if [[ -d $POT ]]; then + display_alert "Adding to repository $release" "main" "ext" + aptly repo add -force-replace=${replace} -config=config/aptly.conf $release $POT/*.deb + fi + + # adding utils + if [[ -d ${POT}extra/$release/utils ]]; then + display_alert "Adding to repository $release" "utils" "ext" + aptly repo add -force-replace=${replace} -config=config/aptly.conf "$release"-utils ${POT}extra/$release/utils/*.deb + fi + + # adding desktop + if [[ -d ${POT}extra/$release/desktop ]]; then + display_alert "Adding to repository $release" "desktop" "ext" + aptly repo add -force-replace=${replace} -config=config/aptly.conf "$release"-desktop ${POT}extra/$release/desktop/*.deb fi - # add all packages - aptly repo add -force-replace=true -config=config/aptly.conf $release $POT/*.deb + # publish + aptly publish -passphrase=$GPG_PASS -origin=Armbian -label=Armbian -config=config/aptly.conf -component=main,utils,desktop \ + --distribution=$release repo $release $release"-utils" $release"-desktop" - # add all distribution packages - if [[ -d $POT/$release ]]; then - aptly repo add -force-replace=true -config=config/aptly.conf $release $POT/*.deb - fi - - aptly publish -passphrase=$GPG_PASS -origin=Armbian -label=Armbian -force-overwrite=true -config=config/aptly.conf -component=main --distribution=$release repo $release > /dev/null 2>&1 - - #aptly repo show -config=config/aptly.conf $release done +aptly repo list -config=config/aptly.conf } # prepare_host