1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-25 16:40:07 -07:00

kiss: Fix /etc/ handling bug.

The shell implementations of readlink and sha256sum were being
used always (instead of as a fallback). This commit ensures that
the real utilities are used where possible.

This also means that there is a bug in the openssl fallback of
sha256sum which will be fixed in the following commit.
This commit is contained in:
Dylan Araps 2020-05-07 14:39:44 +03:00
parent 7df8acc0f1
commit 8a51e76de9
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

8
kiss
View File

@ -146,7 +146,7 @@ decompress() {
esac < "$1"
}
readlink() (
readlink_sh() (
# This is a 'readlink' utility written with POSIX utilities.
# 'ls' is used to obtain the target of the symlink.
#
@ -190,7 +190,7 @@ readlink() (
printf '%s\n' "$target"
)
sha256sum() {
sha256sum_sh() {
# This is an implementation of 'sha256sum' using openssl/libressl.
# The checksums are merely extracted from the output and reformatted
# to match that of 'sha256sum'.
@ -1594,11 +1594,11 @@ main() {
# Check to see if the readlink command exists in the system. If it does
# not, fallback to a POSIX shell implementation of 'readlink'.
readlink=$(command -v readlink) || readlink=readlink
readlink=$(command -v readlink) || readlink=readlink_sh
# Check to see if the sha256sum command exists in the system. If it does
# not, fallback to using openssl.
sha256sum=$(command -v sha256sum) || sha256sum=sha256sum
sha256sum=$(command -v sha256sum) || sha256sum=sha256sum_sh
# Make note of the user's current ID to do root checks later on.
# This is used enough to warrant a place here.