]> git.ipfire.org Git - pakfire.git/commitdiff
Drop old shell function libraries
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 14 Jun 2021 13:50:43 +0000 (13:50 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 14 Jun 2021 14:06:36 +0000 (14:06 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/scripts/cleanup [deleted file]
src/scripts/find-common [deleted file]
src/scripts/functions-common [deleted file]
src/scripts/functions-constants [deleted file]
src/scripts/functions-directories [deleted file]
src/scripts/functions-files [deleted file]
src/scripts/functions-lists [deleted file]
src/scripts/functions-logging [deleted file]

index 18521f06c5ead8ee01597571570a00b363e7dc05..e3061207e5ef1480a39f511f250c1fb83b881d08 100644 (file)
@@ -546,9 +546,7 @@ dist_scripts_SCRIPTS = \
        src/scripts/check-rpaths \
        src/scripts/check-symlinks \
        src/scripts/check-unsafe-files \
-       src/scripts/cleanup \
        src/scripts/compress-man-pages \
-       src/scripts/find-common \
        src/scripts/find-prerequires \
        src/scripts/find-provides \
        src/scripts/find-requires \
@@ -559,14 +557,6 @@ dist_scripts_SCRIPTS = \
        src/scripts/remove-static-libs \
        src/scripts/strip
 
-dist_scripts_DATA = \
-       src/scripts/functions-common \
-       src/scripts/functions-constants \
-       src/scripts/functions-directories \
-       src/scripts/functions-files \
-       src/scripts/functions-lists \
-       src/scripts/functions-logging
-
 # ------------------------------------------------------------------------------
 
 dist_macros_DATA = \
diff --git a/src/scripts/cleanup b/src/scripts/cleanup
deleted file mode 100644 (file)
index 49e7c1b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-dirname=$(dirname ${0})
-
-. ${dirname}/common-functions
-
-directory_remove_orphans $@
diff --git a/src/scripts/find-common b/src/scripts/find-common
deleted file mode 100644 (file)
index d2fc80c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-. ${BASEDIR}/functions-common
diff --git a/src/scripts/functions-common b/src/scripts/functions-common
deleted file mode 100644 (file)
index 4c44a58..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-# Simply import all files from this directory that
-# begin with functions-*.
-
-BASEDIR=$(dirname ${BASH_SOURCE[0]})
-
-for file in ${BASEDIR}/functions-*; do
-       # Avoid infinite loop when importing this file again
-       [ "$(basename ${file})" = "functions-common" ] && continue
-
-       . ${file}
-done
-
diff --git a/src/scripts/functions-constants b/src/scripts/functions-constants
deleted file mode 100644 (file)
index 99e4b7a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-# Debugging mode for these scripts
-DEBUG=0
-
-# Interpreters that should not be found by find_interpreters()
-INTERPRETERS_TO_BE_SKIPPED="/usr/bin/env"
-
-# Some path constants...
-LIBRARY_PATHS="/lib /usr/lib /libexec /usr/libexec"
-BINARY_PATHS="${LIBRARY_PATHS} /bin /sbin /usr/bin /usr/sbin"
-
-# List of directories that could probably empty and are removed automatically
-# so they won't appear in any package.
-ORPHAN_CANDIDATES="${BINARY_PATHS} /usr /usr/include /usr/share"
-for i in $(seq 0 9); do
-       ORPHAN_CANDIDATES="${ORPHAN_CANDIDATES} /usr/share/man/man${i}"
-done
-ORPHAN_CANDIDATES="${ORPHAN_CANDIDATES} /usr/lib/pkgconfig"
-ORPHAN_CANDIDATES="${ORPHAN_CANDIDATES} /usr/lib/python*"
-
-# Mark for 64bit
-mark64="()(64bit)"
diff --git a/src/scripts/functions-directories b/src/scripts/functions-directories
deleted file mode 100644 (file)
index 700321c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-function dir_is_empty() {
-       [ "$(ls -A $@ 2>/dev/null | wc -l)" = "0" ]
-}
-
-function directory_remove_orphans() {
-       if [ "${QUALITY_AGENT_NO_DIRECTORY_PRUNE}" = "yes" ]; then
-               return
-       fi
-
-       local basedir=${1}
-
-       log DEBUG "Removing orphans in ${basedir}"
-
-       local dir
-       local dir_pattern
-       for dir_pattern in ${ORPHAN_CANDIDATES}; do
-               dir=$(echo ${basedir}/${dir_pattern})
-
-               for dir in ${dir}; do
-                       echo "DIR ${dir}" >&2
-                       [ -d "${dir}" ] || continue
-
-                       if dir_is_empty ${dir}; then
-                               log DEBUG "  Found orphaned directory: ${dir}"
-                               rm -rf ${dir}
-                       fi
-               done
-       done
-}
-
diff --git a/src/scripts/functions-files b/src/scripts/functions-files
deleted file mode 100644 (file)
index ab0ba34..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-#!/bin/bash
-
-# Check if a file is an ELF binary
-#
-function file_is_elf() {
-       local file=${1}
-
-       file "${file}" 2>/dev/null | grep -q "ELF"
-}
-
-# Check if a file is a script.
-#   If the first line starts with #! this is sufficient.
-#
-function file_is_script() {
-       local file=${1}
-
-       file ${file} 2>/dev/null | egrep -q ":.* (commands|script)"
-}
-
-# Check if file is an 64-bit binary.
-function file_is_64bit() {
-       local file=${1}
-
-       file -L ${file} 2>/dev/null | grep -q "ELF 64-bit"
-}
-
-# Get the interpreter of a file.
-#
-function file_get_interpreter() {
-       local file=${1}
-
-       if file_is_elf ${file}; then
-               file_get_elf_interpreter ${file}
-       elif file_is_script ${file}; then
-               file_get_script_interpreter ${file}
-       fi
-}
-
-# Hidden function that gets the interpreter from an ELF file.
-#
-function file_get_elf_interpreter() {
-       local file=${1}
-
-       local interp=$(readelf -l ${file} 2>/dev/null | \
-               grep "program interpreter" | tr -d "]" | awk '{ print $NF }')
-
-       # Only return real file names. Debugging files do not
-       # have those starting with a /.
-       if [ "${interp:0:1}" = "/" ]; then
-               echo "${interp}"
-               return
-       fi
-}
-
-# Hidden fucntion that gets the interpreter from a script file.
-#
-function file_get_script_interpreter() {
-       local file=${1}
-
-       # If the file is not executeable, no interpreter will be needed
-       [ -x "${file}" ] || return
-
-       local first_line=$(head -n1 ${file})
-
-       # Return nothing if no shebang was found.
-       [ "${first_line:0:2}" = "#!" ] || return
-
-       first_line="${first_line:2:${#first_line}}"
-
-       # Choose the first argument and strip any parameters if available
-       local interpreter
-       for interpreter in ${first_line}; do
-               # Skip interpreters that do that have an absolute path.
-               [ "${interpreter:0:1}" = "/" ] || break
-
-               echo "${interpreter}"
-               return
-       done
-}
-
-# Check if a file is statically linked.
-#
-function file_is_static() {
-       local file=${1}
-
-       file ${file} 2>/dev/null | grep -q "statically linked"
-}
-
-# Get NEEDED from a file.
-#
-function file_get_needed() {
-       local file=${1}
-
-       local out=$(readelf -d ${file} 2>/dev/null | grep NEEDED | \
-               tr -d "[]" | awk '{ print $NF }')
-
-       echo "${out}$(file_is_64bit ${file})"
-}
-
-# Get RPATH from a file.
-#
-function file_get_rpath() {
-       local file=${1}
-
-       readelf -d ${file} 2>/dev/null | grep RPATH | \
-               tr -d "[]" | awk '{ print $NF }'
-}
-
-# Get SONAME from a file.
-#
-function file_get_soname() {
-       local file=${1}
-
-       objdump -p ${file} 2>/dev/null | awk '/SONAME/ { print $2 }'
-}
-
-# Check if a file is a shared object.
-#
-function file_is_shared_object() {
-       local file=${1}
-
-       file ${file} 2>/dev/null | grep -q "shared object"
-}
-
-# Check if a file has the canary.
-#
-function file_has_canary() {
-       local file=${1}
-
-       readelf -s ${file} 2>/dev/null | grep -q "__stack_chk_fail"
-}
-
-# Check if a file has an executeable stack.
-#
-function file_has_execstack() {
-       local file=${1}
-
-       readelf -h ${file} 2>/dev/null | grep -qE "Type:[[:space:]]*EXEC"
-}
-
-# Check if a file has NX.
-#
-function file_has_nx() {
-       local file=${1}
-
-       readelf -l ${file} 2>/dev/null | grep "GNU_STACK" | grep -q "RWE"
-       [ $? != 0 ]
-}
-
-# Check if a file is partly RELRO.
-#
-function file_is_relro_partly() {
-       local file=${1}
-
-       readelf -l ${file} 2>/dev/null | grep -q "GNU_RELRO"
-}
-
-# Check if a file is fully RELRO.
-#
-function file_is_relro_full() {
-       local file=${1}
-
-       if file_is_relro_partly ${file}; then
-               readelf -d ${file} 2>/dev/null | grep -q "BIND_NOW"
-               return $?
-       fi
-       return 1
-}
-
-# Find all ELF files.
-#
-function find_elf_files() {
-       local dir
-       local dirs
-       local prefix
-
-       while [ $# -gt 0 ]; do
-               case "${1}" in
-                       --prefix=*)
-                               prefix="${1#--prefix=}/"
-                               ;;
-                       *)
-                               dirs="${dirs} ${1}"
-                               ;;
-               esac
-               shift
-       done
-
-       local file
-       local files
-
-       for dir in ${dirs}; do
-               dir="${prefix}${dir}"
-               for file in $(find ${dir} -type f -not -name "*.ko" 2>/dev/null); do
-                       case "${file}" in
-                               # Skip kernel modules.
-                               */lib/modules/*)
-                                       continue
-                                       ;;
-                       esac
-
-                       if file_is_elf ${file} && ! file_is_static ${file}; then
-                               files="${files} ${file}"
-                       fi
-               done
-       done
-
-       echo ${files}
-}
-
-function filter_startfiles() {
-       local file=${1}
-
-       grep -qE "crt[1in]\.o$" <<<${file}
-}
diff --git a/src/scripts/functions-lists b/src/scripts/functions-lists
deleted file mode 100644 (file)
index d8152d4..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-function listsort() {
-       local item
-       for item in $@; do
-               echo "${item}"
-       done | sort -u | tr "\n" " "
-}
-
-function listmatch() {
-       local arg=${1}
-       shift
-
-       local item
-       for item in $@; do
-               if [ "${arg}" = "${item}" ]; then
-                       return 0
-               fi
-       done
-       return 1
-}
-
-function sort_by_length() {
-       local c
-       local i
-       for i in $@; do
-               echo "$(wc -c <<<${i}) ${i}"
-       done | sort -n -r | while read c i; do
-               echo "${i}"
-       done
-}
diff --git a/src/scripts/functions-logging b/src/scripts/functions-logging
deleted file mode 100644 (file)
index 4fd43ed..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-function log() {
-       local level=${1}
-       shift
-
-       if [ "${level}" = "DEBUG" ] && [ "${DEBUG}" != "1" ]; then
-               return
-       fi
-
-       printf " %1s | %s\n" "${level:0:1}" "$@" >&2
-}