mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-05 00:27:38 +08:00
mirror-check: Remove due to being made obsolete by lastsync.py
This commit is contained in:
parent
a260097d8b
commit
4ee2ac55db
@ -1,22 +0,0 @@
|
||||
#
|
||||
# Chakra Packages for Chakra, part of chakra-project.org
|
||||
#
|
||||
|
||||
pkgname=mirror-check
|
||||
pkgver=1.0
|
||||
pkgrel=4
|
||||
pkgdesc="Checks whether the locally used mirror is synced with the main"
|
||||
arch=('x86_64')
|
||||
url="http://www.chakraos.org"
|
||||
license=('GPL2')
|
||||
makedepends=('asciidoc')
|
||||
source=('mirror-check' 'mirror-check.desktop')
|
||||
md5sums=('48e35a4e632185c666e2e9199060cae5'
|
||||
'5a0a0a1774ecd4808827e4c3cd6eca7c')
|
||||
|
||||
package() {
|
||||
cd ${srcdir}
|
||||
|
||||
install -m 755 -D mirror-check "$pkgdir/usr/bin/mirror-check"
|
||||
install -Dm644 "${srcdir}/mirror-check.desktop" "${pkgdir}/usr/share/applications/mirror-check.desktop"
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Chakra Mirror-Check - Version 1.0
|
||||
# Copyright (c) 2013 - Manuel Tortosa <manutortosa@chakra-project.org>
|
||||
#
|
||||
# This script is licensed under the GPLv3
|
||||
|
||||
_title="Mirror-Check"
|
||||
_repos="$(cat /etc/pacman.conf | grep -v "#" | grep -v "options" | grep "\[" | cut -d[ -f2 | cut -d] -f1 | uniq | sed "{:q;N;s/\n/ /g;t q}")"
|
||||
_parse=""
|
||||
_count=0
|
||||
_errors=""
|
||||
_mode=$(echo ${1})
|
||||
|
||||
function select_dialog() {
|
||||
local repo=""
|
||||
local repostring=""
|
||||
|
||||
for repo in ${_repos[@]}; do
|
||||
repostring="${repostring} ${repo} ${repo} on "
|
||||
done
|
||||
|
||||
_parse=$(kdialog --title "${_title}" --checklist "Repositories being checked:" ${repostring})
|
||||
_parse=$(echo ${_parse} | sed 's/"//g')
|
||||
|
||||
for repo in $_parse; do
|
||||
((_count++))
|
||||
done
|
||||
}
|
||||
|
||||
function get_database() {
|
||||
# Get databases
|
||||
local mirror="$(grep '^[^#]erver' /etc/pacman.d/mirrorlist | head -1 | cut -d' ' -f3 |sed 's,$repo.*,'"${1}/x86_64/${1}.db.tar.gz,")"
|
||||
wget -qO /tmp/.${UID}mirrordb.tmp "$mirror"
|
||||
local cmirror="http://rsync.chakraos.org/packages/${1}/x86_64/${1}.db.tar.gz"
|
||||
wget -qO /tmp/.${UID}maindb.tmp "$cmirror"
|
||||
}
|
||||
|
||||
function progress_dialog() {
|
||||
local repo=""
|
||||
local count=1
|
||||
local mirror=""
|
||||
local cmirror=""
|
||||
|
||||
local dbusRef=$(kdialog --title "${_title}" --progressbar "Initializing..." ${_count})
|
||||
for repo in $_parse; do
|
||||
qdbus $dbusRef Set "" value $count &>/dev/null
|
||||
qdbus $dbusRef setLabelText "Checking repository: ${repo}" &>/dev/null
|
||||
((count++))
|
||||
|
||||
get_database "${repo}"
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
_errors=$(echo -e "${_errors} <strong>[${repo}]</strong> could not be found.<br />")
|
||||
else
|
||||
md5sum -b /tmp/.${UID}mirrordb.tmp | sed 's/mirror/main/' > /tmp/.${UID}checkmd5.tmp
|
||||
md5sum -c /tmp/.${UID}checkmd5.tmp >/dev/null 2>/dev/null ||
|
||||
_errors=$(echo -e "${_errors} <strong>[${repo}]</strong> is not synced.<br />")
|
||||
fi
|
||||
done
|
||||
qdbus $dbusRef close &>/dev/null
|
||||
}
|
||||
|
||||
function results_dialog(){
|
||||
if [ "${_errors}" != "" ]; then
|
||||
kdialog --title "${_title}" --sorry "Warning:<br /><br />${_errors}" &>/dev/null
|
||||
else
|
||||
kdialog --title "${_title}" --msgbox "Success. Checked mirrors are synced." &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
function cli_mode() {
|
||||
echo " "
|
||||
|
||||
if [ ! -f "/etc/pacman.conf" ]; then
|
||||
echo -e "\e[00;31mError. Could not find '/etc/pacman.conf'\e[00m"
|
||||
echo " "
|
||||
exit
|
||||
fi
|
||||
|
||||
echo -e "\e[01;33mChecking ${_repos[@]}...\e[00m"
|
||||
echo " "
|
||||
for repo in ${_repos[@]}; do
|
||||
|
||||
get_database "${repo}"
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Repo '$repo' could not be found" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
md5sum -b /tmp/.${UID}mirrordb.tmp | sed 's/mirror/main/' > /tmp/.${UID}checkmd5.tmp
|
||||
md5sum -c /tmp/.${UID}checkmd5.tmp >/dev/null 2>/dev/null &&
|
||||
echo -e "\e[01;37m[$repo]\e[00m \e[00;32mis synced\e[00m." ||
|
||||
echo -e "\e[01;37m[$repo]\e[00m \e[00;31mis not synced\e[00m."
|
||||
done
|
||||
echo " "
|
||||
}
|
||||
|
||||
if [ "${_mode}" == "--gui" ]; then
|
||||
|
||||
if [ ! -f "/etc/pacman.conf" ]; then
|
||||
kdialog --title "${_title}" --error "Error. Could not find '/etc/pacman.conf'" &>/dev/null
|
||||
exit
|
||||
fi
|
||||
|
||||
select_dialog
|
||||
|
||||
if [ "${_parse}" != "" ]; then
|
||||
progress_dialog
|
||||
results_dialog
|
||||
fi
|
||||
|
||||
elif [ "${_mode}" == "--help" ]; then
|
||||
|
||||
echo "${_title}"
|
||||
echo " "
|
||||
echo "Usage: mirror-check <flag>"
|
||||
echo " "
|
||||
echo "--cli Command Line Interface mode (default)"
|
||||
echo "--gui KDialog GUI"
|
||||
echo "--help This message"
|
||||
echo " "
|
||||
|
||||
else
|
||||
|
||||
cli_mode
|
||||
|
||||
fi
|
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Version=2.0
|
||||
Name=MIrror-Check
|
||||
Icon=network-server-database
|
||||
Exec=/usr/bin/mirror-check --gui
|
||||
Categories=Network;
|
Loading…
Reference in New Issue
Block a user