Commit 9301306e authored by PoroCYon's avatar PoroCYon
Browse files

fix update

parent fb39497e
......@@ -16,14 +16,14 @@ EOF
# TODO: src-db getver $pkg?
read_pkg_version() {
local EPKG=$(escape_string "$1")
< "$SSPT_SRC_DB_FILE" grep -E "^$EPKG " | grep -E -v -o "^$EPKG "
< "$SSPT_SRC_DB_FILE" grep -E "^$EPKG " | grep -E -o "[A-Za-z0-9_\.\-]*$"
}
update_package() {
local PKG="$1"
local BEFORE="$(read_pkg_version)"
local BEFORE="$(read_pkg_version "$1")"
exec_subcommand pkgcmd pull "$PKG"
local AFTER=$(exec_subcommand pkgcmd version "$PKG")
local AFTER="$(exec_subcommand pkgcmd version "$PKG")"
if [ "$BEFORE" != "$AFTER" ]; then
exec_subcommand src-db reg "$PKG" "$AFTER"
......@@ -47,10 +47,9 @@ upgrade_pkgs() {
}
update_selection() {
touch /tmp/upgrade_list
local ALLARGS=("$@")
for PKG in "${ALLARGS[@]}"; do
echo "$PGK: "
if ! update_package "$PKG"; then
echo "$PKG" >> /tmp/upgrade_list
fi
......@@ -60,9 +59,8 @@ update_selection() {
}
update_all() {
touch /tmp/upgrade_list
while read -r PKG; do
echo "$PGK: "
if ! update_package "$PKG"; then
echo "$PKG" >> /tmp/upgrade_list
fi
......@@ -71,6 +69,11 @@ update_all() {
upgrade_pkgs
}
if [ -f "/tmp/upgrade_list" ]; then
rm /tmp/upgrade_list
fi
touch /tmp/upgrade_list
if [ $# -eq 0 ]; then
update_all
exit
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment