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