@@ -16,10 +16,25 @@ add_package_repo()
1616 sudo apt update
1717}
1818
19- DIST_NAME=$( lsb_release -sc)
20-
19+ DIST_NAME=$( grep ' ^VERSION_CODENAME=' /etc/os-release| sed ' s/.*=//' )
2120: ${IRODS_VSN:= 4.3.1-0~$DIST_NAME }
2221
22+ # Expand a spec of the leading version tuple eg. 4.3.4 out to the full name of
23+ # the most recent matching version of the package
24+
25+ irods_package_vsn () {
26+ apt list -a irods-server 2> /dev/null| awk ' {print $2}' | grep ' \w' | sort| \
27+ grep " $( perl -e ' print quotemeta($ARGV[0])' " $IRODS_PACKAGE_VERSION " ) " | tail -1
28+ }
29+
30+ # Report irods server version installed, or failing that, the requested version.
31+
32+ irods_vsn () {
33+ local V=$( dpkg -l irods-server 2> /dev/null| grep ' ^ii\s' | awk ' {print $3}' )
34+ V=
35+ echo " ${V:- $IRODS_VSN } "
36+ }
37+
2338while [[ " $1 " = -* ]]; do
2439 ARG=" $1 "
2540 shift
@@ -101,14 +116,15 @@ ________"
101116 ;;
102117
103118 4)
104- sudo apt install -y irods-{dev,runtime}${IRODS_PACKAGE_VERSION: +" =$IRODS_PACKAGE_VERSION " }
119+ IRODS_TO_INSTALL=` irods_package_version`
120+ sudo apt install -y irods-{dev,runtime}${IRODS_TO_INSTALL=: +" =$IRODS_TO_INSTALL =" }
105121 if [[ $with_opts != * \ basic\ * ]]; then
106- sudo apt install -y irods-{icommands,server,database-plugin-postgres}${IRODS_PACKAGE_VERSION : +" =$IRODS_PACKAGE_VERSION " }
122+ sudo apt install -y irods-{icommands,server,database-plugin-postgres}${IRODS_TO_INSTALL= : +" =$IRODS_TO_INSTALL = " }
107123 fi
108124 ;;
109125
110126 5)
111- if [ ! " $IRODS_VSN " ' <' " 4.3" ]; then
127+ if [ ! ` irods_vsn ` ' <' " 4.3" ]; then
112128 PYTHON=python3
113129 else
114130 PYTHON=python2
0 commit comments