Skip to content

Commit 24e8416

Browse files
author
hastmu
committed
update for build system
1 parent 59d1e23 commit 24e8416

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

.include.build.deb.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ DEBIAN["Section"]="base"
99
DEBIAN["Priority"]="optional"
1010
DEBIAN["Architecture"]="all"
1111
DEBIAN["Depends"]="coreutils, grep, sed, wget, avahi-utils"
12-
DEBIAN["Conflict"]="squid-deb-proxy-client"
12+
DEBIAN["Conflict"]="squid-deb-proxy-client, auto-apt-proxy"
1313
DEBIAN["Maintainer"]="[email protected]"
1414
DEBIAN["Description"]="apt proxy detection"
1515

deploy-deb.sh

+34-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
echo "- deploying..."
4+
source .include.common.sh
45

56
(
67
cd "$(dirname "$0")"
@@ -42,8 +43,16 @@ echo "- deploying..."
4243
continue
4344
fi
4445

46+
branch_name="${branch#*/}" ; branch_name=${branch_name//\//-}
4547
branch_tag=${tag_hash[${branch_hash}]:="none"}
46-
echo "${branch_type} - ${branch_hash} - ${branch} - TAG[${branch_tag}]"
48+
if [ "${branch_tag}" == "none" ]
49+
then
50+
branch_version="0.0.0"
51+
branch_tag="${branch_hash:0:7}-$(date +%s)"
52+
else
53+
branch_version="${branch_tag//v/}"
54+
fi
55+
echo "${branch_type} - ${branch_hash} - ${branch_name} - TAG[${branch_tag}] - VERSION[${branch_version}]"
4756

4857
DPKG_BUILD_ROOT="${T_DIR}/.dpkg-root/${branch_hash}"
4958
mkdir -p "${DPKG_BUILD_ROOT}"
@@ -57,6 +66,30 @@ echo "- deploying..."
5766
gen_control_file
5867
gen_rootfs
5968
find "${DPKG_BUILD_ROOT}"
69+
deb_name="${DEBIAN["Package"]}-${DEBIAN["Version"]}_${DEBIAN["Architecture"]}.deb"
70+
if dpkg -b "${DPKG_BUILD_ROOT}" "${T_DIR}/.dpkg-root/${deb_name}"
71+
then
72+
ls -al "${T_DIR}/.dpkg-root/${deb_name}"
73+
echo "DIST: ${DIST[${branch_type}.pool.${DEBIAN["Architecture"]}]}"
74+
75+
mv -v "${T_DIR}/.dpkg-root/${deb_name}" \
76+
"${DIST["root"]}/${DIST[${branch_type}.pool.${DEBIAN["Architecture"]}]}/."
77+
78+
# remove old versions if unstable
79+
if [ "${branch_type}" == "unstable" ]
80+
then
81+
search_name="${deb_name}"
82+
# echo "${search_name%-*}"
83+
echo "- remove all unstable without latest hash"
84+
# remove all not latest unstable
85+
find "${DIST["root"]}/${DIST[${branch_type}.pool.${DEBIAN["Architecture"]}]}/." -type f ! -name "${search_name%-*}*.deb" -print0 \
86+
| xargs -0 -n1 rm -fv
87+
# only keep oldest with the same hash
88+
echo "- keep oldest with latest hash"
89+
find "${DIST["root"]}/${DIST[${branch_type}.pool.${DEBIAN["Architecture"]}]}/." -type f -name "${DEBIAN["Package"]}*.deb" \
90+
| sort -n | tail -n +2 | xargs -n1 rm -rvf
91+
fi
92+
fi
6093
fi
6194
)
6295

0 commit comments

Comments
 (0)