From d2ec0d85596f12ec184261a3fb016915ae18b865 Mon Sep 17 00:00:00 2001 From: meminz <110640498+meminz@users.noreply.github.com> Date: Mon, 9 Feb 2026 16:32:44 +0100 Subject: [PATCH 1/2] Fix mkdir command to create directory with -p flag --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f1ae60c..abaf4d3 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Install: ``` curl https://raw.githubusercontent.com/boredsquirrel/COPR-command/main/copr -O ./copr run0 sh -c ' - mkdir /var/usrlocal/bin + mkdir -p /var/usrlocal/bin mv ./copr /var/usrlocal/bin chown -R root:root /var/usrlocal/bin chcon -R system_u:object_r:bin_t:s0 /var/usrlocal/bin From a8cd51d741b8fe3868e92bf055cbdea9562e9a84 Mon Sep 17 00:00:00 2001 From: meminz Date: Mon, 9 Feb 2026 16:45:04 +0100 Subject: [PATCH 2/2] fixed unbound variables by adding empty values if not provided --- copr | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/copr b/copr index 6664f49..1188762 100644 --- a/copr +++ b/copr @@ -2,8 +2,8 @@ set -euo pipefail # assign variables for author, reponame and releaseversion -author="$(echo "$2" | cut -d '/' -f1)" -reponame="$(echo "$2" | cut -d '/' -f2)" +author="$(echo "${2:-}" | cut -d '/' -f1)" +reponame="$(echo "${2:-}" | cut -d '/' -f2)" releasever="$(rpm -E %fedora)" repofile="/etc/yum.repos.d/_copr_$author-$reponame.repo" repofilebak="$HOME/COPR/_copr_$author-$reponame.repo" @@ -89,7 +89,7 @@ move-repo () { # Main loop -if [[ "$1" == "enable" ]]; then +if [[ "${1:-}" == "enable" ]]; then while true; do read -rp "$question" yn case $yn in @@ -114,13 +114,13 @@ if [[ "$1" == "enable" ]]; then done # disable a repo -elif [[ "$1" == "disable" ]]; then +elif [[ "${1:-}" == "disable" ]]; then sed 's/enabled=1/enabled=0/g' "$repofile" >/dev/null && echo "Repository "$author"/"$reponame" disabled." || echo "Already disabled or repo not found." # remove the named repo -elif [[ "$1" == "remove" ]]; then +elif [[ "${1:-}" == "remove" ]]; then if [[ -e "$repofile" ]]; then move-repo @@ -145,14 +145,14 @@ elif [[ "$1" == "remove" ]]; then fi # list all installed COPR repositories -elif [[ "$1" == "list" ]]; then +elif [[ "${1:-}" == "list" ]]; then find /etc/yum.repos.d/ -type f -name '_copr*' -exec basename {} \; | sed 's/_copr_//; s/\.repo$//' # search, this is just implemented through the browser (hey, pip does the same!) -elif [[ "$1" == "search" ]]; then +elif [[ "${1:-}" == "search" ]]; then xdg-open "https://copr.fedorainfracloud.org/coprs/fulltext/?fulltext=$2" # display the helptext -elif [[ "$1" == "" || "$1" == "-h" || "$1" == "--h" || "$1" == "-help" || "$1" == "--help" || "$1" == "help" ]]; then +elif [[ "${1:-}" == "" || "$1" == "-h" || "$1" == "--h" || "$1" == "-help" || "$1" == "--help" || "$1" == "help" ]]; then echo "$helptext" fi