pkg_manifest: remove subshell

This commit is contained in:
Dylan Araps 2021-07-05 13:26:16 +03:00
parent cbc638ac11
commit 9c89761268
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

8
kiss
View File

@ -578,14 +578,12 @@ EOF
fi fi
} }
pkg_manifest() ( pkg_manifest() {
# Generate the package's manifest file. This is a list of each file # Generate the package's manifest file. This is a list of each file
# and directory inside the package. The file is used when uninstalling # and directory inside the package. The file is used when uninstalling
# packages, checking for package conflicts and for general debugging. # packages, checking for package conflicts and for general debugging.
log "$1" "Generating manifest" log "$1" "Generating manifest"
# This function runs as a sub-shell to avoid having to 'cd' back to the
# prior directory before being able to continue.
cd "${2:-$pkg_dir}/$1" cd "${2:-$pkg_dir}/$1"
# find: Print all files and directories and append '/' to directories. # find: Print all files and directories and append '/' to directories.
@ -599,7 +597,9 @@ pkg_manifest() (
# sed: Remove the first character in each line (./dir -> /dir) and # sed: Remove the first character in each line (./dir -> /dir) and
# remove all lines which only contain '.'. # remove all lines which only contain '.'.
sort -r | sed '/^\.\/$/d;ss.ss' > "$PWD/$pkg_db/$1/manifest" sort -r | sed '/^\.\/$/d;ss.ss' > "$PWD/$pkg_db/$1/manifest"
)
cd "$OLDPWD"
}
pkg_manifest_validate() { pkg_manifest_validate() {
log "$1" "Checking if manifest valid" log "$1" "Checking if manifest valid"