Nitpicks in maintainer scripts
There is no need for quotes in variables assignments since dash 0.5.11 or newer, cf [1]. The keyword 'local' is supported by dash, so let's use it consistently, cf [2]. It seems that we want to quote filenames, so let's try to do it consistently, even though at the moment spaces in filenames are not supported anyway, due to the loops 'for f in $FILES_TO_DIVERT'. [1]: https://unix.stackexchange.com/a/97569/105794 [2]: https://stackoverflow.com/a/18600920
This commit is contained in:
parent
f8e8487d44
commit
6633eac355
17
debian/kali-themes.postinst
vendored
17
debian/kali-themes.postinst
vendored
@ -35,8 +35,8 @@ FILES_TO_DIVERT="
|
||||
|
||||
install_all() {
|
||||
local opt=$1
|
||||
for file in $FILES_TO_DIVERT
|
||||
do
|
||||
local file=
|
||||
for file in $FILES_TO_DIVERT; do
|
||||
install_config_file "$file" "$opt"
|
||||
done
|
||||
}
|
||||
@ -45,18 +45,19 @@ install_config_file() {
|
||||
local file=$1
|
||||
local opt=$2
|
||||
local orig_file="/usr/share/kali-themes$file"
|
||||
if [ "$opt" = "force" ] || ([ ! -e $file ] && [ -e $orig_file ]); then
|
||||
if [ "$opt" = "force" ] || ([ ! -e "$file" ] && [ -e "$orig_file" ]); then
|
||||
echo "Installing $orig_file as $file"
|
||||
mkdir -p $(dirname $file)
|
||||
cp $orig_file $file
|
||||
mkdir -p "$(dirname "$file")"
|
||||
cp "$orig_file" "$file"
|
||||
fi
|
||||
}
|
||||
|
||||
remove_config_file() {
|
||||
rm -f $1
|
||||
local file=$1
|
||||
rm -f "$file"
|
||||
dpkg-divert --rename --package kali-themes \
|
||||
--divert "$1.original" \
|
||||
--remove "$1"
|
||||
--divert "$file.original" \
|
||||
--remove "$file"
|
||||
}
|
||||
|
||||
if [ "$1" = "configure" ]; then
|
||||
|
||||
2
debian/kali-themes.postrm
vendored
2
debian/kali-themes.postrm
vendored
@ -34,7 +34,7 @@ FILES_TO_DIVERT="
|
||||
" # END FILES_TO_DIVERT
|
||||
|
||||
drop_diversion() {
|
||||
local file="$1"
|
||||
local file=$1
|
||||
dpkg-divert --rename --package kali-themes \
|
||||
--divert "$file.original" \
|
||||
--remove "$file"
|
||||
|
||||
4
debian/kali-themes.preinst
vendored
4
debian/kali-themes.preinst
vendored
@ -34,8 +34,8 @@ FILES_TO_DIVERT="
|
||||
" # END FILES_TO_DIVERT
|
||||
|
||||
setup_diversion() {
|
||||
local file="$1"
|
||||
divert_opts="--rename"
|
||||
local file=$1
|
||||
local divert_opts="--rename"
|
||||
if [ -e "$file" ]; then
|
||||
if dpkg --search "$file" >/dev/null 2>&1; then
|
||||
# Keep original file to avoid spurious dpkg prompt
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user