mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 04:12:42 +00:00
apt-delete-old-debs
This commit is contained in:
parent
7fca77ec9f
commit
40715aed42
15
docker.sh
15
docker.sh
@ -55,24 +55,17 @@ rm $cfg
|
|||||||
if [[ ! -z ${DRY_RUN:-} ]]; then
|
if [[ ! -z ${DRY_RUN:-} ]]; then
|
||||||
export APT_DRY_RUN=1
|
export APT_DRY_RUN=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
base_url="https://apt.dockerproject.org/repo"
|
base_url="https://apt.dockerproject.org/repo"
|
||||||
remote_filelist="${APT_PATH}/filelist.remote"
|
remote_filelist="${APT_PATH}/filelist"
|
||||||
local_filelist="${APT_PATH}/filelist.local"
|
[[ -f $remote_filelist ]] && rm $remote_filelist
|
||||||
|
|
||||||
for version in ${APT_VERSIONS[@]}; do
|
for version in ${APT_VERSIONS[@]}; do
|
||||||
apt-download-binary ${base_url} "$version" "main" "amd64" "${APT_PATH}" ${remote_filelist} || true
|
apt-download-binary ${base_url} "$version" "main" "amd64" "${APT_PATH}" ${remote_filelist} || true
|
||||||
apt-download-binary ${base_url} "$version" "main" "i386" "${APT_PATH}" ${remote_filelist} || true
|
apt-download-binary ${base_url} "$version" "main" "i386" "${APT_PATH}" ${remote_filelist} || true
|
||||||
done
|
done
|
||||||
|
|
||||||
APT_BACKUP_PATH="${BASE_PATH}/backup/apt"
|
apt-delete-old-debs ${APT_PATH} $remote_filelist
|
||||||
mkdir -p ${APT_BACKUP_PATH}
|
|
||||||
(cd ${APT_PATH}; find . -type f -iname "*.deb") | sed 's+^\./++' > ${local_filelist}
|
|
||||||
comm <(sort $remote_filelist) <(sort $local_filelist) -13 | while read file; do
|
|
||||||
echo "deleting ${file}"
|
|
||||||
mv "${APT_PATH}/$file" ${APT_BACKUP_PATH}
|
|
||||||
done
|
|
||||||
|
|
||||||
rm ${remote_filelist} ${local_filelist}
|
|
||||||
|
|
||||||
# sync_docker "http://apt.dockerproject.org/" "${TUNASYNC_WORKING_DIR}/apt"
|
# sync_docker "http://apt.dockerproject.org/" "${TUNASYNC_WORKING_DIR}/apt"
|
||||||
# sync_docker "http://yum.dockerproject.org/" "${TUNASYNC_WORKING_DIR}/yum"
|
# sync_docker "http://yum.dockerproject.org/" "${TUNASYNC_WORKING_DIR}/yum"
|
||||||
|
@ -172,4 +172,20 @@ function apt-download-binary() {
|
|||||||
return $ERROR
|
return $ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function apt-delete-old-debs {
|
||||||
|
local base_dir=$1
|
||||||
|
local remote_filelist=$2
|
||||||
|
|
||||||
|
[[ ! -d ${base_dir} ]] && return 1
|
||||||
|
[[ ! -f ${remote_filelist} ]] && return 1
|
||||||
|
|
||||||
|
local_filelist="${base_dir}/filelist.local"
|
||||||
|
(cd ${base_dir}; find . -type f -iname "*.deb") | sed 's+^\./++' > ${local_filelist}
|
||||||
|
comm <(sort $remote_filelist) <(sort $local_filelist) -13 | while read file; do
|
||||||
|
echo "deleting ${file}"
|
||||||
|
rm ${file}
|
||||||
|
done
|
||||||
|
rm $local_filelist
|
||||||
|
}
|
||||||
|
|
||||||
# vim: ts=4 sts=4 sw=4
|
# vim: ts=4 sts=4 sw=4
|
||||||
|
12
termux.sh
12
termux.sh
@ -11,20 +11,14 @@ base_url=${TUNASYNC_UPSTREAM_URL:-"https://termux.net"}
|
|||||||
|
|
||||||
ARCHES=("aarch64" "all" "arm" "i686")
|
ARCHES=("aarch64" "all" "arm" "i686")
|
||||||
|
|
||||||
remote_filelist="${BASE_PATH}/filelist.remote"
|
remote_filelist="${BASE_PATH}/filelist"
|
||||||
local_filelist="${BASE_PATH}/filelist.local"
|
[[ -f $remote_filelist ]] && rm $remote_filelist
|
||||||
|
|
||||||
for arch in ${ARCHES[@]}; do
|
for arch in ${ARCHES[@]}; do
|
||||||
echo "start syncing: ${arch}"
|
echo "start syncing: ${arch}"
|
||||||
apt-download-binary "${base_url}" "stable" "main" "${arch}" "${BASE_PATH}" ${remote_filelist} || true
|
apt-download-binary "${base_url}" "stable" "main" "${arch}" "${BASE_PATH}" ${remote_filelist} || true
|
||||||
done
|
done
|
||||||
|
|
||||||
BACKUP_PATH="${BASE_PATH}/backup/"
|
apt-delete-old-debs ${BASE_PATH} $remote_filelist
|
||||||
mkdir -p ${BACKUP_PATH}
|
|
||||||
(cd ${BASE_PATH}; find . -type f -iname "*.deb") | sed 's+^\./++' > ${local_filelist}
|
|
||||||
comm <(sort $remote_filelist) <(sort $local_filelist) -13 | while read file; do
|
|
||||||
echo "deleting ${file}"
|
|
||||||
mv "${BASE_PATH}/$file" ${BACKUP_PATH}
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "finished"
|
echo "finished"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user