Fixes for shellcheck
This commit is contained in:
parent
1085640b77
commit
4b67365b54
6 changed files with 34 additions and 33 deletions
|
@ -10,6 +10,6 @@ clone() {
|
||||||
echo "Run 'portzap pull' instead."
|
echo "Run 'portzap pull' instead."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
umask $clone_mask
|
umask "$clone_mask"
|
||||||
git clone $ports_url $portzap_dir
|
git clone "$ports_url" "$portzap_dir"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
__changed_files() {
|
__changed_files() {
|
||||||
rev=$1
|
rev=$1
|
||||||
echo $(
|
echo $(
|
||||||
git diff --name-only --diff-filter=RAM $rev..HEAD | \
|
git diff --name-only --diff-filter=RAM "$rev"..HEAD | \
|
||||||
cut -d / -f1 -f2 | \
|
cut -d / -f1 -f2 | \
|
||||||
uniq
|
uniq
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,7 @@ __changed_files() {
|
||||||
|
|
||||||
__removed_files() {
|
__removed_files() {
|
||||||
rev=$1
|
rev=$1
|
||||||
echo $(git diff --name-only --diff-filter=D $rev..HEAD)
|
echo $(git diff --name-only --diff-filter=D "$rev"..HEAD)
|
||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
|
@ -19,35 +19,34 @@ install() {
|
||||||
portzap_dir=$2
|
portzap_dir=$2
|
||||||
libexec_dir=$3
|
libexec_dir=$3
|
||||||
portzap_file=$4
|
portzap_file=$4
|
||||||
|
cd "$portzap_dir" || exit 1
|
||||||
cd $portzap_dir
|
|
||||||
if [ -e "$portzap_file" ]; then
|
if [ -e "$portzap_file" ]; then
|
||||||
rev=$(cat $portzap_file)
|
rev=$(cat "$portzap_file")
|
||||||
ch_files=$(eval __changed_files "$rev")
|
ch_files=$(eval __changed_files "$rev")
|
||||||
rm_files=$(eval __removed_files "$rev")
|
rm_files=$(eval __removed_files "$rev")
|
||||||
for file in $rm_files; do
|
for file in $rm_files; do
|
||||||
echo RM $ports_dir/$file
|
echo RM "$ports_dir/$file"
|
||||||
rm $ports_dir/$file
|
rm "$ports_dir/$file"
|
||||||
done
|
done
|
||||||
for file in $ch_files; do
|
for file in $ch_files; do
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
echo $file
|
echo "$file"
|
||||||
$libexec_dir/install-file $ports_dir $file
|
"$libexec_dir/install-file" "$ports_dir" "$file"
|
||||||
else
|
else
|
||||||
dir=$file
|
dir=$file
|
||||||
$libexec_dir/install-directory $ports_dir $libexec_dir $dir
|
"$libexec_dir/install-directory" "$ports_dir" "$libexec_dir" "$dir"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
find -s . -maxdepth 1 -type f \
|
find -s . -maxdepth 1 -type f \
|
||||||
\( -not -name ".gitignore" \) \
|
\( -not -name ".gitignore" \) \
|
||||||
\( -not -name ".arcconfig" \) \
|
\( -not -name ".arcconfig" \) \
|
||||||
-exec $libexec_dir/install-file $ports_dir {} +
|
-exec "$libexec_dir/install-file" "$ports_dir" {} +
|
||||||
find -s . -maxdepth 1 -type d \
|
find -s . -maxdepth 1 -type d \
|
||||||
\( -not -name "." \) \
|
\( -not -name "." \) \
|
||||||
\( -not -name ".git" \) \
|
\( -not -name ".git" \) \
|
||||||
\( -not -name ".hooks" \) \
|
\( -not -name ".hooks" \) \
|
||||||
-exec $libexec_dir/install-directory $ports_dir $libexec_dir {} +
|
-exec "$libexec_dir/install-directory" "$ports_dir" "$libexec_dir" {} +
|
||||||
fi
|
fi
|
||||||
echo $(git rev-parse HEAD) > $portzap_file
|
git rev-parse HEAD > "$portzap_file"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,9 @@
|
||||||
pull() {
|
pull() {
|
||||||
portzap_dir=$1
|
portzap_dir=$1
|
||||||
pull_mask=$2
|
pull_mask=$2
|
||||||
|
|
||||||
if [ -e "$portzap_dir/.git" ]; then
|
if [ -e "$portzap_dir/.git" ]; then
|
||||||
umask $pull_mask
|
umask "$pull_mask"
|
||||||
cd $portzap_dir
|
cd "$portzap_dir" || exit 1
|
||||||
git pull --rebase origin hardenedbsd/main
|
git pull --rebase origin hardenedbsd/main
|
||||||
else
|
else
|
||||||
echo "Run 'portzap clone' first."
|
echo "Run 'portzap clone' first."
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
require_deps() {
|
require_deps() {
|
||||||
deps=$1
|
deps=$1
|
||||||
for dep in $deps; do
|
for dep in $deps; do
|
||||||
which -s $dep
|
if ! which -s "$dep"; then
|
||||||
if [ $? -ne 0 ]; then
|
echo "$dep" is required, but not found
|
||||||
echo $dep is required, but not found
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -11,7 +12,7 @@ require_deps() {
|
||||||
|
|
||||||
require_group() {
|
require_group() {
|
||||||
group=$1
|
group=$1
|
||||||
cmd=$(id -Gn | tr ' ' '\n' | grep ^${group}$)
|
cmd=$(id -Gn | tr ' ' '\n' | grep "^${group}$")
|
||||||
if [ "$cmd" != "$group" ]; then
|
if [ "$cmd" != "$group" ]; then
|
||||||
echo "You must be a member of the '$group' group to run this command."
|
echo "You must be a member of the '$group' group to run this command."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -19,7 +20,7 @@ require_group() {
|
||||||
}
|
}
|
||||||
|
|
||||||
require_root() {
|
require_root() {
|
||||||
if [ $(id -u) -ne 0 ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo "The install command must be run as root."
|
echo "The install command must be run as root."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -4,20 +4,21 @@ libexec_dir=$2
|
||||||
group=_portzap
|
group=_portzap
|
||||||
mode=u=rwx,g=rwx,o=
|
mode=u=rwx,g=rwx,o=
|
||||||
for i in $(seq 3 $#); do
|
for i in $(seq 3 $#); do
|
||||||
relative_portzap_dir=$(eval echo -n \${$i})
|
relative_portzap_dir=$(eval echo -n "\${$i}")
|
||||||
|
realpath=$(realpath "$ports_dir/$relative_portzap_dir")
|
||||||
# Install directory
|
# Install directory
|
||||||
install -d -g $group -m $mode \
|
install -d -g $group -m $mode \
|
||||||
$relative_portzap_dir \
|
"$relative_portzap_dir" \
|
||||||
$ports_dir/$relative_portzap_dir
|
"$ports_dir/$relative_portzap_dir"
|
||||||
echo $(realpath $ports_dir/$relative_portzap_dir)
|
echo "$realpath"
|
||||||
|
|
||||||
# Install files
|
# Install files
|
||||||
find $relative_portzap_dir -maxdepth 1 -type f \
|
find "$relative_portzap_dir" -maxdepth 1 -type f \
|
||||||
\( -not -name ".gitignore" \) \
|
\( -not -name ".gitignore" \) \
|
||||||
\( -not -name ".arcconfig" \) \
|
\( -not -name ".arcconfig" \) \
|
||||||
-exec $libexec_dir/install-file $ports_dir/$relative_portzap_dir {} +
|
-exec "$libexec_dir/install-file" "$ports_dir/$relative_portzap_dir" {} +
|
||||||
|
|
||||||
# Install subdirs (recursive)
|
# Install subdirs (recursive)
|
||||||
find -s $relative_portzap_dir -depth 1 -type d \
|
find -s "$relative_portzap_dir" -depth 1 -type d \
|
||||||
-exec $libexec_dir/install-directory $ports_dir $libexec_dir {} \;
|
-exec "$libexec_dir/install-directory" "$ports_dir" "$libexec_dir" {} \;
|
||||||
done
|
done
|
||||||
|
|
|
@ -4,6 +4,7 @@ group=_portzap
|
||||||
mode=u=rw,g=rw,o=
|
mode=u=rw,g=rw,o=
|
||||||
files=""
|
files=""
|
||||||
for i in $(seq 2 $#); do
|
for i in $(seq 2 $#); do
|
||||||
files="${files} $(eval echo -n \${$i})"
|
file=$(eval echo -n "\$$i")
|
||||||
|
files="$files $file"
|
||||||
done
|
done
|
||||||
install -g $group -m $mode $files $dest
|
install -g $group -m $mode "$files" "$dest"
|
||||||
|
|
Loading…
Reference in a new issue