Skip to content

Commit

Permalink
fix: support absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
shenmo7192 authored May 31, 2024
1 parent 1aa6a31 commit 341ccd5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions loong64-it/loong64-it.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ abinfo() { echo -e "[\e[96mINFO\e[0m]: \e[1m$*\e[0m"; }
abdbg() { echo -e "[\e[32mDEBUG\e[0m]: \e[1m$*\e[0m"; }

_convert_loong64() {
HERE=$(basename $1)
PKG_NAME=$(dpkg-deb -f "$1" Package)
VERSION=$(dpkg-deb -f "$1" Version)
PKG_PATH=$(realpath $1)
PKG_NAME=$(dpkg-deb -f "$PKG_PATH" Package)
VERSION=$(dpkg-deb -f "$PKG_PATH" Version)
HERE=$(basename $1)
abinfo "Examining package information: $1 ..."
dpkg -I "$SRCDIR"/$1 || \
dpkg -I "$PKG_PATH" || \
aberr "Invalid dpkg package: control (metadata) archive not found: $?"
CONTROL_EXT="$(ar t "$SRCDIR"/$1 | grep control.tar* | cut -f3 -d'.')"
CONTROL_EXT="$(ar t "$PKG_PATH" | grep control.tar* | cut -f3 -d'.')"
case "${CONTROL_EXT}" in
gz)
TAR_COMP_FLAG="z"
Expand All @@ -50,7 +51,7 @@ _convert_loong64() {
cd $(mktemp -d) || \
aberr "Failed to create temporary directory to unpack $1: $?."
DEBDIR="$(pwd)"
ar xv "$SRCDIR"/$1 || \
ar xv "$PKG_PATH" || \
aberr "Failed to unpack $1: $?."

abinfo "Unpacking metadata archive: $1 ..."
Expand Down Expand Up @@ -80,7 +81,7 @@ _convert_loong64() {
cd "$DEBDIR"

abinfo "Rebuilding dpkg package $1: loong64 ..."
ar rv "$SRCDIR"/$1 control.tar.${CONTROL_EXT} || \
ar rv "$PKG_PATH" control.tar.${CONTROL_EXT} || \
aberr "Failed to rebuild dpkg package $1: $?."

#abinfo "Cleaning up: $1 ..."
Expand Down

0 comments on commit 341ccd5

Please sign in to comment.