diff --git a/automataCI/services/archive/ar.ps1 b/automataCI/services/archive/ar.ps1 index d0f3ad8b..24ab39c0 100644 --- a/automataCI/services/archive/ar.ps1 +++ b/automataCI/services/archive/ar.ps1 @@ -9,15 +9,16 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_AUTOMATA}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" +. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" function AR-Is-Available { # execute - $__process = Get-Command "ar" -ErrorAction SilentlyContinue - if (-not ($__process)) { + $___process = OS-Is-Command-Available "ar" + if ($___process -ne 0) { return 1 } @@ -31,26 +32,30 @@ function AR-Is-Available { function AR-Create { param ( - [string]$__name, - [string]$__list + [string]$___name, + [string]$___list ) # validate input - if ([string]::IsNullOrEmpty($__name) -or [string]::IsNullOrEmpty($__list)) { + if (($(STRINGS-Is-Empty "${___name}") -eq 0) -or + ($(STRINGS-Is-Empty "${___list}") -eq 0)) { return 1 } - $__process = AR-Is-Available - if ($__process -ne 0) { + $___process = AR-Is-Available + if ($___process -ne 0) { return 1 } # execute - $__process = OS-Exec "ar" "r ${__name} ${__list}" + $___process = OS-Exec "ar" "r ${___name} ${___list}" + if ($___process -ne 0) { + return 1 + } # report status - return $__process + return 0 } diff --git a/automataCI/services/archive/ar.sh b/automataCI/services/archive/ar.sh index fe5a7abb..de1995ea 100644 --- a/automataCI/services/archive/ar.sh +++ b/automataCI/services/archive/ar.sh @@ -10,12 +10,20 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. -AR::is_available() { +. "${LIBS_AUTOMATACI}/services/io/os.sh" +. "${LIBS_AUTOMATACI}/services/io/strings.sh" + + + + +AR_Is_Available() { # execute - if [ -z "$(type -t ar)" ]; then + OS::is_command_available "ar" + if [ $? -ne 0 ]; then return 1 fi + # report status return 0 } @@ -23,25 +31,30 @@ AR::is_available() { -AR::create() { - # __name="$1" - # __list="$2" +AR_Create() { + #___name="$1" + #___list="$2" # validate input - if [ -z "$1" ] || [ -z "$2" ]; then + if [ $(STRINGS_Is_Available "$1") -eq 0 ] || + [ $(STRINGS_Is_Available "$2") -eq 0 ]; then + return 1 + fi + + AR_Is_Available + if [ $? -ne 0 ]; then return 1 fi # execute ar r "$1" $2 + if [ $? -ne 0 ]; then + return 1 + fi # report status - if [ $? -eq 0 ]; then - return 0 - fi - - return 1 + return 0 } diff --git a/automataCI/services/compilers/deb.sh b/automataCI/services/compilers/deb.sh index c6518655..37ca38df 100644 --- a/automataCI/services/compilers/deb.sh +++ b/automataCI/services/compilers/deb.sh @@ -86,7 +86,7 @@ DEB_Create_Archive() { # archive into deb ___file="package.deb" - AR::create "$___file" "debian-binary control.tar.xz data.tar.xz" + AR_Create "$___file" "debian-binary control.tar.xz data.tar.xz" if [ $? -ne 0 ]; then cd "$___current_path" && unset ___current_path return 1 @@ -472,7 +472,7 @@ DEB_Is_Available() { return 1 fi - AR::is_available + AR_Is_Available if [ $? -ne 0 ]; then return 1 fi