[Git][NTPsec/ntpsec][master] 4 commits: Fail hard when we can't figure out package manager
Eric S. Raymond
gitlab at mg.gitlab.com
Mon Mar 27 04:49:22 UTC 2017
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
4a3ac883 by Kenneth Finnegan at 2017-03-26T20:26:04-07:00
Fail hard when we can't figure out package manager
Instead of sliding through the whole script with install undefined,
print an error message and die.
- - - - -
ee3e113d by Kenneth Finnegan at 2017-03-26T20:53:34-07:00
Adds option parsing and makes ntpviz optional
Replace the single -n flag with the ability to scan across a whole list
of options.
Adds a second option flag --ntpviz, and no longer installs ntpviz
dependencies by default.
- - - - -
a1ce1a8a by Kenneth Finnegan at 2017-03-26T20:58:04-07:00
Remove unused variable inst from buildprep
- - - - -
cfb864ba by Kenneth Finnegan at 2017-03-26T21:12:27-07:00
Cleanup uid != 0 check and error message in buildprep
- - - - -
1 changed file:
- buildprep
Changes:
=====================================
buildprep
=====================================
--- a/buildprep
+++ b/buildprep
@@ -14,21 +14,39 @@ cat <<EOF
#
EOF
-if [ "$1" = "-n" ]
-then
- do=echo
- echo "# Run this without -n, as root, for actual installation.\n#"
-else
- do=""
-fi
+# Set the defaults
+DRYRUN="no"
+NTPVIZ="no"
-if [ "$do" = "" -a `id -u` != 0 ]
+# Loop through option flags
+for optflag in "$@"
+do
+ case "$optflag" in
+ -n)
+ DRYRUN="yes"
+ ;;
+ --ntpviz)
+ NTPVIZ="yes"
+ ;;
+ *)
+ echo "# Unknown argument: $optflag"
+ ;;
+ esac
+done
+
+if [ "$DRYRUN" = "yes" ]
then
- echo "#You must be running as root for your installer to do its thing."
- exit 1
+ do=echo
+ echo "# Run this without -n, as root, for actual installation.\n#"
+else
+ do=""
+ if [ "$(id -u)" != 0 ]
+ then
+ echo "# ERROR: You must be running as root for your installer to do its thing."
+ exit 1
+ fi
fi
-inst=""
if emerge --version 2>/dev/null
then
installer=emerge
@@ -55,7 +73,8 @@ then
installer=yast
install="$do $installer --install"
else
- installer=unknown
+ echo "# ERROR: Package manager unidentified - Unsupported operating system"
+ exit 1
fi
echo "# Your package installer is ${installer}."
echo ""
@@ -160,7 +179,14 @@ ntpviz () {
# Main sequence
daemon
tools
-ntpviz
+
+if [ "$NTPVIZ" = "yes" ]
+then
+ ntpviz
+else
+ echo ""
+ echo "# Skipping ntpviz dependencies [--ntpviz]"
+fi
echo ""
echo "# Done."
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/7ca1d4e745bd180322ef2c246d6d1a93f97550d5...cfb864baa77048b866bb867065a129a1b883ce11
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170327/05d2f21f/attachment.html>
More information about the vc
mailing list