forked from kiss-community/kiss
kiss: Minor nitpicks
This commit is contained in:
parent
64d0ef3f90
commit
f1b551db4e
29
kiss
29
kiss
@ -66,8 +66,7 @@ esc() {
|
|||||||
# Escape all required characters in both the search and
|
# Escape all required characters in both the search and
|
||||||
# replace portions of two strings for use in a 'sed' call
|
# replace portions of two strings for use in a 'sed' call
|
||||||
# as "plain-text".
|
# as "plain-text".
|
||||||
printf 's/^%s$/%s/' \
|
printf 's/^%s$/%s/' "$(printf %s "$1" | sed 's/[]\/$*.^[]/\\&/g')" \
|
||||||
"$(printf %s "$1" | sed 's/[]\/$*.^[]/\\&/g')" \
|
|
||||||
"$(printf %s "$2" | sed 's/[\/&]/\\&/g')"
|
"$(printf %s "$2" | sed 's/[\/&]/\\&/g')"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +74,7 @@ pop() {
|
|||||||
# Remove an item from a "string list". This allows us
|
# Remove an item from a "string list". This allows us
|
||||||
# to remove a 'sed' call and reuse this code throughout.
|
# to remove a 'sed' call and reuse this code throughout.
|
||||||
del=$1
|
del=$1
|
||||||
shift
|
shift 2
|
||||||
|
|
||||||
for i do [ "$i" = "$del" ] || printf %s " $i "; done
|
for i do [ "$i" = "$del" ] || printf %s " $i "; done
|
||||||
}
|
}
|
||||||
@ -362,18 +361,16 @@ pkg_strip() {
|
|||||||
# it allows us to remove 'file' from the
|
# it allows us to remove 'file' from the
|
||||||
# core repositories altogether.
|
# core repositories altogether.
|
||||||
find "$pkg_dir/$1" -type f | while read -r file; do
|
find "$pkg_dir/$1" -type f | while read -r file; do
|
||||||
case $(readelf -h "$file" 2>/dev/null) in
|
case $(readelf -h "$file") in
|
||||||
*" DYN "*) strip_opt=unneeded ;;
|
*" DYN "*) strip_opt=unneeded ;;
|
||||||
*" EXEC "*) strip_opt=all ;;
|
*" EXEC "*) strip_opt=all ;;
|
||||||
*" REL "*) strip_opt=debug ;;
|
*" REL "*) strip_opt=debug ;;
|
||||||
*) continue
|
*) continue
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Suppress errors here as some binaries and libraries may
|
strip "--strip-$strip_opt" "$file" &&
|
||||||
# fail to strip. This is OK.
|
|
||||||
strip "--strip-$strip_opt" "$file" 2>/dev/null &&
|
|
||||||
printf 'Stripped %10s %s\n' "($strip_opt)" "${file##$pkg_dir/$1}"
|
printf 'Stripped %10s %s\n' "($strip_opt)" "${file##$pkg_dir/$1}"
|
||||||
done
|
done 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_fixdeps() {
|
pkg_fixdeps() {
|
||||||
@ -506,8 +503,8 @@ pkg_build() {
|
|||||||
# package, remove it from the explicit list as it needs to be
|
# package, remove it from the explicit list as it needs to be
|
||||||
# installed as a dependency.
|
# installed as a dependency.
|
||||||
# shellcheck disable=2086
|
# shellcheck disable=2086
|
||||||
for pkg do
|
for pkg do contains "$deps" "$pkg" &&
|
||||||
contains "$deps" "$pkg" && explicit=$(pop "$pkg" $explicit)
|
explicit=$(pop "$pkg" from $explicit)
|
||||||
done
|
done
|
||||||
|
|
||||||
# See [1] at top of script.
|
# See [1] at top of script.
|
||||||
@ -533,7 +530,7 @@ pkg_build() {
|
|||||||
# Remove the now installed package from the build list.
|
# Remove the now installed package from the build list.
|
||||||
# See [1] at top of script.
|
# See [1] at top of script.
|
||||||
# shellcheck disable=2046,2086
|
# shellcheck disable=2046,2086
|
||||||
set -- $(pop "$pkg" "$@")
|
set -- $(pop "$pkg" from "$@")
|
||||||
} done
|
} done
|
||||||
|
|
||||||
for pkg do pkg_sources "$pkg"; done
|
for pkg do pkg_sources "$pkg"; done
|
||||||
@ -698,7 +695,7 @@ pkg_conflicts() {
|
|||||||
# Generate a list of all installed package manifests
|
# Generate a list of all installed package manifests
|
||||||
# and remove the current package from the list.
|
# and remove the current package from the list.
|
||||||
# shellcheck disable=2046,2086
|
# shellcheck disable=2046,2086
|
||||||
set -- $(set +f; pop "$sys_db/$p_name/manifest" "$sys_db"/*/manifest)
|
set -- $(set +f; pop "$sys_db/$p_name/manifest" from "$sys_db"/*/manifest)
|
||||||
|
|
||||||
[ -s "$cac_dir/$pid-m" ] || return 0
|
[ -s "$cac_dir/$pid-m" ] || return 0
|
||||||
|
|
||||||
@ -919,9 +916,7 @@ pkg_install() {
|
|||||||
# Install can also take the full path to a tar-ball.
|
# Install can also take the full path to a tar-ball.
|
||||||
# We don't need to check the repository if this is the case.
|
# We don't need to check the repository if this is the case.
|
||||||
if [ -f "$1" ] && [ -z "${1%%*.tar.*}" ] ; then
|
if [ -f "$1" ] && [ -z "${1%%*.tar.*}" ] ; then
|
||||||
tar_file=$1
|
tar_file=$1 pkg_name=${1##*/} pkg_name=${pkg_name%#*}
|
||||||
pkg_name=${1##*/}
|
|
||||||
pkg_name=${pkg_name%#*}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
pkg_cache "$1" ||
|
pkg_cache "$1" ||
|
||||||
@ -1135,13 +1130,11 @@ pkg_updates() {
|
|||||||
|
|
||||||
log "Packages to update: ${outdated% }"
|
log "Packages to update: ${outdated% }"
|
||||||
|
|
||||||
# Tell 'pkg_build' to always prompt before build.
|
|
||||||
pkg_update=1
|
|
||||||
|
|
||||||
# Build all packages requiring an update.
|
# Build all packages requiring an update.
|
||||||
# See [1] at top of script.
|
# See [1] at top of script.
|
||||||
# shellcheck disable=2046,2086
|
# shellcheck disable=2046,2086
|
||||||
{
|
{
|
||||||
|
pkg_update=1
|
||||||
pkg_order $outdated
|
pkg_order $outdated
|
||||||
pkg_build $order
|
pkg_build $order
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user