From 89dd681fc63c17dfd3e624eaf297ab00affc53a0 Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Wed, 3 May 2023 18:41:57 +0200 Subject: [PATCH] fix: adding and removing package from random dir --- debrepo | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/debrepo b/debrepo index a0564ef..1a45ea8 100755 --- a/debrepo +++ b/debrepo @@ -33,12 +33,12 @@ fi if [ "$1" = "add" ] || [ "$1" = "-a" ] || [ "$1" = "--add" ]; then # copy deb file to repo folder structure if [ "$2" = "--letter-based-structure" ] || [ "$2" = "-l" ];then - first_letter=$(echo "$3" | sed 's/[.\/]//g' | cut -c 1 | tr '[:upper:]' '[:lower:]') - pkg_name=$(echo "$3" | awk -F "_" '{print $1}') + first_letter=$(echo "$3" | sed 's/.*\///' | cut -c 1 | tr '[:upper:]' '[:lower:]') + pkg_name=$(echo "$3" | sed 's/.*\///' | awk -F "_" '{print $1}') mkdir -p "$REPODIR/apt-repo/pool/main/$first_letter/$pkg_name/" - cp "./$3" "$REPODIR/apt-repo/pool/main/$first_letter/$pkg_name/$3" + cp "$3" "$REPODIR/apt-repo/pool/main/$first_letter/$pkg_name/" else - cp "./$2" "$REPODIR/apt-repo/pool/main/" + cp "$2" "$REPODIR/apt-repo/pool/main/" fi # generate package and release file @@ -48,8 +48,8 @@ if [ "$1" = "add" ] || [ "$1" = "-a" ] || [ "$1" = "--add" ]; then fi if [ "$1" = "del" ] || [ "$1" = "-d" ] || [ "$1" = "--del" ]; then - first_letter=$(echo "$2" | sed 's/[.\/]//g' | cut -c 1 | tr '[:upper:]' '[:lower:]') - pkg_name=$(echo "$2" | awk -F "_" '{print $1}') + first_letter=$(echo "$2" | sed 's/.*\///' | cut -c 1 | tr '[:upper:]' '[:lower:]') + pkg_name=$(echo "$2" | sed 's/.*\///' | awk -F "_" '{print $1}') if [ -f "$REPODIR/apt-repo/pool/main/$first_letter/$pkg_name/$2" ]; then # remove package