[Git][NTPsec/ntpsec][master] 4 commits: buildprep: Add --update option, not included in -a, --all ...

Matt Selsky (@selsky) gitlab at mg.gitlab.com
Wed Jan 18 07:49:24 UTC 2023



Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
e3a73347 by James Browning at 2023-01-18T07:43:18+00:00
buildprep: Add --update option, not included in -a, --all ...

but not mutually exclusive
- - - - -
5a3d6f19 by James Browning at 2023-01-18T07:43:18+00:00
buildprep: Use $() rather than back-tics from shellcheck.


- - - - -
6132dafc by James Browning at 2023-01-18T07:43:18+00:00
buildprep: Double quote echo to pacify shellcheck.


- - - - -
635dceb6 by James Browning at 2023-01-18T07:43:18+00:00
buildprep: Double quote Python packages to pacify shellcheck.


- - - - -


1 changed file:

- buildprep


Changes:

=====================================
buildprep
=====================================
@@ -9,9 +9,10 @@
 DRYRUN="no"
 NTPVIZ="no"
 DOC="no"
+UPDATE="no"
 PYVERS=""
 
-OS=`uname -s`
+OS=$(uname -s)
 
 # Loop through option flags
 for optflag in "$@"
@@ -26,6 +27,7 @@ $0 - prepare your system for an NTPsec source build
     -n --dry-run Only show what would be done instead of doing it
        --ntpviz  Install dependencies for ntpviz tool
        --doc     Install dependencies for building documentation
+       --update  Update package repositories
     -a --all     Install all possible dependencies
 EOF
 		exit 0
@@ -43,6 +45,9 @@ EOF
 		NTPVIZ="yes"
 		DOC="yes"
 		;;
+	 --update)
+		UPDATE="yes"
+		;;
 	 *)
 		echo "# WARNING: Unknown argument: $optflag"
 		echo "#"
@@ -54,7 +59,7 @@ done
 # Python 3 equivalents with a python3 prefix.  Compute the correct value for the
 # infix based on system Python.  This eill start to be significant after Python 2
 # EOLs at the beginning of 2020.
-PYVERS=`python --version 2>&1 | sed -n -e '/Python \([0-9]\).*/s//\1/p'`
+PYVERS=$(python --version 2>&1 | sed -n -e '/Python \([0-9]\).*/s//\1/p')
 if [ "$PYVERS" = "2" ]
 then
     PYVERS=""
@@ -73,7 +78,7 @@ EOF
 
 if [ "$DRYRUN" = "yes" ]
 then
-	do=echo
+	do="echo"
 	echo "# Run this without -n|--dry-run, as root, for actual installation."
 	echo "#"
 else
@@ -165,7 +170,7 @@ daemon () {
     case $installer in
 	apk)
 	    $install build-base python                  # basic tools
-	    $install bison python${PYVERS}-dev linux-headers
+	    $install bison "python${PYVERS}-dev" linux-headers
 	    $install openssl-dev libcap-dev libseccomp-dev
 	    # probably needs more, but this builds
 	    # can't find timepps.h: gpsd and chrony have their own ??
@@ -224,7 +229,7 @@ daemon () {
 	    $install libcap-devel libseccomp-devel 	# build
 	    $install openssl-devel			# build
 	    $install libcap2 openssl-libs
-	    $install python${PYVERS}-curses
+	    $install "python${PYVERS}-curses"
 	    ;;
 	zypper)
 	    $install -t pattern devel_basis		# Build environment
@@ -235,7 +240,7 @@ daemon () {
 	    $install pps-tools-devel			# build
 	    $install pps-tools
 	    $install libcap2 openssl-libs
-	    $install python${PYVERS}-curses
+	    $install "python${PYVERS}-curses"
 	    ;;
     esac
 }
@@ -244,10 +249,10 @@ tools () {
     # Prerequisites for the client Python tools: python extensions
     case $installer in
 	apt)
-	    $install python${PYVERS}-dev
+	    $install "python${PYVERS}-dev"
 	    ;;
 	yum|dnf|yast|zypper)
-	    $install python${PYVERS}-devel
+	    $install "python${PYVERS}-devel"
 	    ;;
     esac
 }
@@ -260,7 +265,7 @@ ntpviz () {
 	    $install ttf-liberation
 	    ;;
 	apt)
-	    distro=`lsb_release -i -s`
+	    distro=$(lsb_release -i -s)
 	    if [ "$distro" = "Ubuntu" ]
 	    then
 		echo "# Looks like an Ubuntu system"
@@ -269,7 +274,7 @@ ntpviz () {
 		echo "# Looks like a generic Debian system"
 		$install gnuplot
 	    fi
-	    $install fonts-liberation python${PYVERS}-psutil
+	    $install fonts-liberation "python${PYVERS}-psutil"
 	    ;;
 	emerge)
 	    $install sci-visualization/gnuplot
@@ -318,6 +323,35 @@ doc () {
 	esac
 }
 
+update() {
+	# prerequisites to build documentation
+	case $installer in
+	emerge)
+		$do $installer --sync
+		;;
+	apk|pkg|pkgin|yum)
+		$do $installer update
+		;;
+	dnf)
+		$do $installer distro-sync
+		;;
+	apt)
+		$do $installer-get update
+		;;
+	zypper)
+		$do $installer-get refresh
+		;;
+	esac
+}
+
+if [ "$UPDATE" = "yes" ]
+then
+	update
+else
+	echo ""
+	echo "# Skipping update of package repositories [-u] [--update]"
+fi
+
 # Main sequence
 daemon
 tools



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/2c494aeac0e4cd09a9c5e32157c816bb8cc0bf42...635dceb64321fb059d7579cb3f1cbed23e6ee329

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/2c494aeac0e4cd09a9c5e32157c816bb8cc0bf42...635dceb64321fb059d7579cb3f1cbed23e6ee329
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20230118/08f1d6f2/attachment-0001.htm>


More information about the vc mailing list