Fix shellcheck
This commit is contained in:
parent
ee5dfd0004
commit
a7e1b9fe7a
3 changed files with 19 additions and 20 deletions
24
bin/portzap
24
bin/portzap
|
@ -13,7 +13,7 @@ libexec=$(realpath "${rootdir}/../libexec/portzap")
|
||||||
##
|
##
|
||||||
# Functions
|
# Functions
|
||||||
require_root() {
|
require_root() {
|
||||||
if [ $(id -u) -ne 0 ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo "This command requires root privileges."
|
echo "This command requires root privileges."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -44,29 +44,29 @@ case $1 in
|
||||||
"clone")
|
"clone")
|
||||||
require_dependency git
|
require_dependency git
|
||||||
require_membership_of _portzap
|
require_membership_of _portzap
|
||||||
${libexec}/portzap-clone "${giturl}" "${gitdir}"
|
"${libexec}"/portzap-clone "${giturl}" "${gitdir}"
|
||||||
;;
|
;;
|
||||||
"pull")
|
"pull")
|
||||||
require_dependency git
|
require_dependency git
|
||||||
require_membership_of _portzap
|
require_membership_of _portzap
|
||||||
${libexec}/portzap-pull "${gitdir}"
|
"${libexec}"/portzap-pull "${gitdir}"
|
||||||
;;
|
;;
|
||||||
"install")
|
"install")
|
||||||
require_root
|
require_root
|
||||||
require_dependency git
|
require_dependency git
|
||||||
${libexec}/portzap-install "${gitdir}" "${installdir}" "${revision}"
|
"${libexec}"/portzap-install "${gitdir}" "${installdir}" "${revision}"
|
||||||
;;
|
;;
|
||||||
"adduser")
|
"adduser")
|
||||||
require_root
|
require_root
|
||||||
${libexec}/portzap-adduser
|
"${libexec}"/portzap-adduser
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo Usage: portzap COMMAND [OPTIONS]
|
printf "Usage: portzap COMMAND [OPTIONS]\n"
|
||||||
echo
|
printf "\n"
|
||||||
echo Commands:
|
printf "Commands:\n"
|
||||||
echo -e " clone Clone the hardenedbsd ports tree."
|
printf " clone Clone the hardenedbsd ports tree.\n"
|
||||||
echo -e " pull Pull updates from the hardenedbsd ports tree."
|
printf " pull Pull updates from the hardenedbsd ports tree.\n"
|
||||||
echo -e " install Install the ports tree into /usr/ports."
|
printf " install Install the ports tree into /usr/ports.\n"
|
||||||
echo -e " adduser Add the portzap user, group and home directory."
|
printf " adduser Add the portzap user, group and home directory.\n"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -2,15 +2,14 @@
|
||||||
set -ex
|
set -ex
|
||||||
gitdir=$1
|
gitdir=$1
|
||||||
installdir=$2
|
installdir=$2
|
||||||
revision=$3
|
|
||||||
excludes=".git .gitignore .hooks .arcconfig"
|
excludes=".git .gitignore .hooks .arcconfig"
|
||||||
|
|
||||||
cd ${gitdir}
|
cd "${gitdir}"
|
||||||
find -s . -maxdepth 1 \
|
find -s . -maxdepth 1 \
|
||||||
-exec cp -Rfv {} ${installdir} \; \
|
-exec cp -Rfv {} "${installdir}" \; \
|
||||||
-exec chown -R root:_portzap ${installdir}/{} \; \
|
-exec chown -R root:_portzap "${installdir}/{}" \; \
|
||||||
-exec chmod -R u=rwX,g=rwX,o= ${installdir}/{} \;
|
-exec chmod -R u=rwX,g=rwX,o= "${installdir}/{}" \;
|
||||||
cd ${installdir}
|
cd "${installdir}"
|
||||||
for exclude in ${excludes}; do
|
for exclude in ${excludes}; do
|
||||||
rm -rf ${exclude}
|
rm -rf "${exclude}"
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -ex
|
set -ex
|
||||||
gitdir=$1
|
gitdir=$1
|
||||||
umask=rwX,g=rwX,o=
|
umask rwX,g=rwX,o=
|
||||||
if [ -e "${gitdir}/.git" ]; then
|
if [ -e "${gitdir}/.git" ]; then
|
||||||
cd "${gitdir}"
|
cd "${gitdir}"
|
||||||
git pull --rebase origin hardenedbsd/main
|
git pull --rebase origin hardenedbsd/main
|
||||||
|
|
Loading…
Reference in a new issue