mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Cleanup for repository management functions
This commit is contained in:
40
general.sh
40
general.sh
@@ -242,52 +242,44 @@ fingerprint_image()
|
||||
EOF
|
||||
}
|
||||
|
||||
addtorepo ()
|
||||
addtorepo()
|
||||
{
|
||||
# add all deb files to repository
|
||||
# parameter "remove" dumps all and creates new
|
||||
# function: cycle trough distributions
|
||||
DISTROS=("wheezy" "jessie" "trusty" "xenial")
|
||||
IFS=" "
|
||||
j=0
|
||||
while [[ $j -lt ${#DISTROS[@]} ]]
|
||||
do
|
||||
# add each packet to distribution
|
||||
DIS=${DISTROS[$j]}
|
||||
local distributions=("wheezy" "jessie" "trusty" "xenial")
|
||||
|
||||
for release in "${distributions[@]}"; do
|
||||
# let's drop from publish if exits
|
||||
if [ "$(aptly publish list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $DIS)" != "" ]; then
|
||||
aptly publish drop -config=config/aptly.conf $DIS > /dev/null 2>&1
|
||||
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
|
||||
fi
|
||||
#aptly db cleanup -config=config/aptly.conf
|
||||
|
||||
if [ "$1" == "remove" ]; then
|
||||
if [[ $1 == remove ]]; then
|
||||
# remove repository
|
||||
aptly repo drop -config=config/aptly.conf $DIS > /dev/null 2>&1
|
||||
aptly repo drop -config=config/aptly.conf $release > /dev/null 2>&1
|
||||
aptly db cleanup -config=config/aptly.conf > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
# create repository if not exist
|
||||
OUT=$(aptly repo list -config=config/aptly.conf -raw | awk '{print $(NF)}' | grep $DIS)
|
||||
if [[ "$OUT" != "$DIS" ]]; then
|
||||
display_alert "Creating section" "$DIS" "info"
|
||||
aptly repo create -config=config/aptly.conf -distribution=$DIS -component=main -comment="Armbian stable" $DIS > /dev/null 2>&1
|
||||
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
|
||||
fi
|
||||
|
||||
# add all packages
|
||||
aptly repo add -force-replace=true -config=config/aptly.conf $DIS $POT/*.deb
|
||||
aptly repo add -force-replace=true -config=config/aptly.conf $release $POT/*.deb
|
||||
|
||||
# add all distribution packages
|
||||
if [ -d "$POT/$DIS" ]; then
|
||||
aptly repo add -force-replace=true -config=config/aptly.conf $DIS $POT/$DIS/*.deb
|
||||
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=$DIS repo $DIS > /dev/null 2>&1
|
||||
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 $DIS
|
||||
|
||||
j=$[$j+1]
|
||||
done
|
||||
#aptly repo show -config=config/aptly.conf $release
|
||||
done
|
||||
}
|
||||
|
||||
# prepare_host
|
||||
|
||||
25
repo-show.sh
25
repo-show.sh
@@ -9,26 +9,19 @@
|
||||
# This file is a part of tool chain https://github.com/igorpecovnik/lib
|
||||
#
|
||||
|
||||
# This scripts shows packages in local repository
|
||||
# This scripts shows packages in local repository
|
||||
|
||||
# load functions
|
||||
source general.sh
|
||||
|
||||
DISTROS=("wheezy" "jessie" "trusty" "xenial")
|
||||
|
||||
showall ()
|
||||
showall()
|
||||
{
|
||||
|
||||
|
||||
# function: cycle trough distributions
|
||||
IFS=" "
|
||||
j=0
|
||||
while [[ $j -lt ${#DISTROS[@]} ]]
|
||||
do
|
||||
# add each packet to distribution
|
||||
DIS=${DISTROS[$j]}
|
||||
echo $DIS
|
||||
aptly repo show -with-packages -config=config/aptly.conf $DIS | tail -n +7
|
||||
|
||||
j=$[$j+1]
|
||||
done
|
||||
for release in "${DISTROS[@]}"; do
|
||||
display_alert "Displaying repository contents for" "$release" "ext"
|
||||
aptly repo show -with-packages -config=config/aptly.conf $release | tail -n +7
|
||||
done
|
||||
}
|
||||
|
||||
showall
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
POT="../output/debs/"
|
||||
|
||||
# load functions
|
||||
source general.sh
|
||||
source general.sh
|
||||
|
||||
# run repository update
|
||||
addtorepo
|
||||
|
||||
Reference in New Issue
Block a user