From af917c06496f1416ece905295cc2bd6a24f1e245 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Sun, 21 Jul 2024 21:41:12 -0300 Subject: [PATCH] Replace script Remove scripts that have been replaced by alternatives --- bin/portzap | 5 +---- bin/setup-portzap | 10 +--------- libexec/portzap/commands/portzap-checkout | 20 +++++--------------- libexec/portzap/commands/portzap-clone | 8 +------- libexec/portzap/commands/portzap-install | 10 ++-------- libexec/portzap/commands/portzap-pull | 8 +------- libexec/portzap/commands/portzap-rm | 6 ++---- libexec/portzap/functions/print.sh | 11 +++++++++++ libexec/portzap/setup/setup-cron | 10 +--------- libexec/portzap/setup/setup-doas | 10 +--------- libexec/portzap/utils/printerr | 10 ---------- libexec/portzap/utils/printok | 10 ---------- share/portzap/RELNOTES | 3 +++ 13 files changed, 29 insertions(+), 92 deletions(-) create mode 100644 libexec/portzap/functions/print.sh delete mode 100644 libexec/portzap/utils/printerr delete mode 100644 libexec/portzap/utils/printok diff --git a/bin/portzap b/bin/portzap index 760a9f7..ab09cce 100755 --- a/bin/portzap +++ b/bin/portzap @@ -13,10 +13,7 @@ revfile="${installdir}"/.portzap ## # functions -printerr() -{ - "${libexec}"/utils/printerr "$1" -} +. "${libexec}"/functions/print.sh require_dependency() { diff --git a/bin/setup-portzap b/bin/setup-portzap index 64b9578..f720ec3 100755 --- a/bin/setup-portzap +++ b/bin/setup-portzap @@ -8,15 +8,7 @@ libexec="${localbase}"/libexec/portzap ## # functions -printok() -{ - "${libexec}"/utils/printok "$1" -} - -printerr() -{ - "${libexec}"/utils/printerr "$1" -} +. "${libexec}"/functions/print.sh ## # main diff --git a/libexec/portzap/commands/portzap-checkout b/libexec/portzap/commands/portzap-checkout index 80b0ea9..e52c6b6 100644 --- a/libexec/portzap/commands/portzap-checkout +++ b/libexec/portzap/commands/portzap-checkout @@ -5,23 +5,13 @@ set -e # variables localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/portzap +git="${libexec}"/utils/git/run gitdir=$1 branch=$2 ## # functions -gitexec() -{ - "${libexec}"/utils/gitexec "${1}" -} - -printok() { - "${libexec}"/utils/printok "${1}" -} - -printerr() { - "${libexec}"/utils/printerr "${1}" -} +. "${libexec}"/functions/print.sh ## # main @@ -41,7 +31,7 @@ if [ ! -e "${gitdir}/.git" ]; then fi cd "${gitdir}" -gitexec "fetch origin" -gitexec "checkout ${branch}" || -gitexec "checkout -t origin/${branch}" +"${git}" fetch origin +"${git}" checkout "${branch}" || +"${git}" checkout -t origin/"${branch}" printok "${branch} checked out" diff --git a/libexec/portzap/commands/portzap-clone b/libexec/portzap/commands/portzap-clone index 79776f5..64852d2 100755 --- a/libexec/portzap/commands/portzap-clone +++ b/libexec/portzap/commands/portzap-clone @@ -12,13 +12,7 @@ branch=$3 ## # functions -printok() { - "${libexec}"/utils/printok "${1}" -} - -printerr() { - "${libexec}"/utils/printerr "${1}" -} +. "${libexec}"/functions/print.sh ## # main diff --git a/libexec/portzap/commands/portzap-install b/libexec/portzap/commands/portzap-install index 4963858..008cbf9 100755 --- a/libexec/portzap/commands/portzap-install +++ b/libexec/portzap/commands/portzap-install @@ -13,6 +13,8 @@ revfile=$3 ## # functions +. "${libexec}"/functions/print.sh + perform_update() { rev=$(cat "${revfile}") @@ -58,14 +60,6 @@ run_install() install -o root -g _portzap -m "${mode}" -v "${@}" } -printok() { - "${libexec}"/utils/printok "${1}" -} - -printerr() { - "${libexec}"/utils/printerr "${1}" -} - ## # main if [ "$(id -u)" != "0" ]; then diff --git a/libexec/portzap/commands/portzap-pull b/libexec/portzap/commands/portzap-pull index 27b4c1a..b760c37 100755 --- a/libexec/portzap/commands/portzap-pull +++ b/libexec/portzap/commands/portzap-pull @@ -10,13 +10,7 @@ gitdir=$1 ## # functions -printok() { - "${libexec}"/utils/printok "${1}" -} - -printerr() { - "${libexec}"/utils/printerr "${1}" -} +. "${libexec}"/functions/print.sh ## # main diff --git a/libexec/portzap/commands/portzap-rm b/libexec/portzap/commands/portzap-rm index 1836622..e5b63a0 100644 --- a/libexec/portzap/commands/portzap-rm +++ b/libexec/portzap/commands/portzap-rm @@ -10,6 +10,8 @@ installdir=$2 ## # functions +. "${libexec}"/functions/print.sh + erase() { dir="${1}" @@ -24,10 +26,6 @@ erase() echo } -printerr() { - "${libexec}"/utils/printerr "${1}" -} - ## # main if [ "$(id -u)" != "0" ]; then diff --git a/libexec/portzap/functions/print.sh b/libexec/portzap/functions/print.sh new file mode 100644 index 0000000..b5d395f --- /dev/null +++ b/libexec/portzap/functions/print.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +printok() +{ + printf "ok: %s\n" "${1}" > /dev/stdout +} + +printerr() +{ + printf "error: %s\n" "${1}" > /dev/stderr +} diff --git a/libexec/portzap/setup/setup-cron b/libexec/portzap/setup/setup-cron index f37ac39..e7029f7 100644 --- a/libexec/portzap/setup/setup-cron +++ b/libexec/portzap/setup/setup-cron @@ -10,15 +10,7 @@ sharedir="${localbase}"/share/portzap ## # functions -printok() -{ - "${libexec}"/utils/printok "$1" -} - -printerr() -{ - "${libexec}"/utils/printerr "$1" -} +. "${libexec}"/functions/print.sh verify_allowfile() { diff --git a/libexec/portzap/setup/setup-doas b/libexec/portzap/setup/setup-doas index e37c7cb..d33c6f1 100644 --- a/libexec/portzap/setup/setup-doas +++ b/libexec/portzap/setup/setup-doas @@ -9,15 +9,7 @@ sharedir="${localbase}/share/portzap" ## # functions -printok() -{ - "${libexec}"/utils/printok "$1" -} - -printerr() -{ - "${libexec}"/utils/printerr "$1" -} +. "${libexec}"/functions/print.sh install_doasconf() { diff --git a/libexec/portzap/utils/printerr b/libexec/portzap/utils/printerr deleted file mode 100644 index 8fdbff6..0000000 --- a/libexec/portzap/utils/printerr +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -set -e - -## -# variables -err="${1}" - -## -# main -printf "error: %s\n" "${err}" > /dev/stderr diff --git a/libexec/portzap/utils/printok b/libexec/portzap/utils/printok deleted file mode 100644 index 315f891..0000000 --- a/libexec/portzap/utils/printok +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -set -e - -## -# variables -msg="${1}" - -## -# main -printf "ok: %s\n" "${msg}" > /dev/stdout diff --git a/share/portzap/RELNOTES b/share/portzap/RELNOTES index e1acade..95504cc 100644 --- a/share/portzap/RELNOTES +++ b/share/portzap/RELNOTES @@ -8,3 +8,6 @@ v?.?.? | Remove "set -x" After this change, portzap emits less output + +| Remove scripts + Remove "utils/printok", "utils/printerr", and "utils/git-rev"