Skip to content

Commit

Permalink
Updated ovjBuild and some installation scripts (#841)
Browse files Browse the repository at this point in the history
ovjBuild requires git to function. It will be installed
if needed. Added -c (--codeonly) option to just clone the
repositories. Documented changes.
On some Ubuntu systems, it seems that the /etc/lsb-release file
may not exist. Generalized the mechanism to determine the release
version to use lsb-release, os-release, or the hostnamectl command.
  • Loading branch information
DanIverson committed Jan 25, 2024
1 parent 4c15667 commit 0ad7471
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/common/manual/ovjBuild
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ on the releases page of github ( https://github.com/OpenVnmrJ/OpenVnmrJ/releases
has undergone a beta test. The Notes.txt file in the dvd image
is the change log for OpenVnmrJ.

Using ovjBuild with the -c (or --codeonly) option will only download
the OpenVnmrJ sources from github. It will not try to compile them.
The git command is required for ovjBuild to work. It will be installed
if it is not present. The ovjBuild command should not be executed from
the root account. It will test that the HOME parameter is not "/root".
17 changes: 15 additions & 2 deletions src/scripts/chksystempkgs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
# check for the packages required for installation of OpenVnmrJ
status=0

setDistMajor() {
distmajor=16
if [[ -f /etc/lsb-release ]]; then
. /etc/lsb-release
distmajor=${DISTRIB_RELEASE:0:2}
elif [[ -f /etc/os-release ]]; then
. /etc/os-release
distmajor=${VERSION_ID:0:2}
elif [[ ! -z $(type -t hostnamectl) ]]; then
ver=$(hostnamectl | grep "Operating" | cut -d " " -f 4)
distmajor=${ver:0:2}
fi
}

#
# rpm (RedHat and CentOS) vs dpkg (Debian)
#
Expand Down Expand Up @@ -56,8 +70,7 @@ if [ ! -x /usr/bin/dpkg ]; then

else
echo "Checking for Ubuntu / Debian packages required by OpenVnmrJ"
. /etc/lsb-release
distmajor=${DISTRIB_RELEASE:0:2}
setDistMajor
packagecommonlist='tcsh make gcc gfortran expect openssh-server mutt sharutils sendmail-cf gnome-power-manager kdiff3 ghostscript imagemagick xterm'
if [ $distmajor -ge 22 ] ; then
packageXlist='default-jre bc libmotif-dev'
Expand Down
17 changes: 15 additions & 2 deletions src/scripts/ins_vnmr2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ logmsg() {
# echo $1 >> $logfile 2>&1
}

setDistMajor() {
distmajor=16
if [[ -f /etc/lsb-release ]]; then
. /etc/lsb-release
distmajor=${DISTRIB_RELEASE:0:2}
elif [[ -f /etc/os-release ]]; then
. /etc/os-release
distmajor=${VERSION_ID:0:2}
elif [[ ! -z $(type -t hostnamectl) ]]; then
ver=$(hostnamectl | grep "Operating" | cut -d " " -f 4)
distmajor=${ver:0:2}
fi
}

#-----------------------------------------------
update_user_group() {
# Just make the group. groupadd will fail if it
Expand Down Expand Up @@ -432,8 +446,7 @@ case x$os_version in
lflvr="suse"
elif [ -r /etc/debian_version ]
then
. /etc/lsb-release
distmajor=${DISTRIB_RELEASE:0:2}
setDistMajor
lflvr="debian"
# Ubuntu has awk
NAWK="awk"
Expand Down
17 changes: 15 additions & 2 deletions src/scripts/installpkgs.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ exclude=turbovnc-*.*.9[0-9]-*
EOF
}

setDistMajor() {
distmajor=16
if [[ -f /etc/lsb-release ]]; then
. /etc/lsb-release
distmajor=${DISTRIB_RELEASE:0:2}
elif [[ -f /etc/os-release ]]; then
. /etc/os-release
distmajor=${VERSION_ID:0:2}
elif [[ ! -z $(type -t hostnamectl) ]]; then
ver=$(hostnamectl | grep "Operating" | cut -d " " -f 4)
distmajor=${ver:0:2}
fi
}

if [ -x /usr/bin/dpkg ]; then
if [[ -f /etc/apt/sources.ovj ]]; then
ovjRepo=1
Expand Down Expand Up @@ -638,8 +652,7 @@ if [ ! -x /usr/bin/dpkg ]; then
fi
echo " "
else
. /etc/lsb-release
distmajor=${DISTRIB_RELEASE:0:2}
setDistMajor
if [ $distmajor -lt 18 ] ; then
echo "Only Ubuntu 18 or newer is supported"
echo " "
Expand Down
32 changes: 32 additions & 0 deletions src/scripts/ovjBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ usage:
options:
-h|--help Display this help information
-c|--cloneonly Only clone the repositories
EOF
exit 1
}

cloneOnly=0

if [[ $(uname -s) != "Linux" ]]; then
echo "$SCRIPT can only be used on Linux systems"
exit 1
Expand All @@ -53,6 +56,10 @@ do
ovj_usage
elif [[ "x$arg" = "x--help" ]]; then
ovj_usage
elif [[ "x$arg" = "x-c" ]]; then
cloneOnly=1
elif [[ "x$arg" = "x--cloneonly" ]]; then
cloneOnly=1
else
echo "unrecognized argument: $arg"
ovj_usage
Expand All @@ -76,6 +83,25 @@ fi

runToolChain=0

if [[ $HOME = "/root" ]]; then
echo "$0 cannot be executed as root"
echo "rerun as OpenVnmrJ user (e.g., vnmr1)"
exit 1
fi

# if git does not exist
if [[ -z $(type -t git) ]] ; then
echo "git command not installed but is required"
if [[ -x /usr/bin/dpkg ]]; then
echo "If requested, enter the admin (sudo) password"
sudo apt update
sudo apt install -y git
else
echo "Please enter this system's root user password"
(su root -c "yum -y install git";)
fi
fi

if [[ ! -d $HOME/ovjbuild ]]; then
mkdir $HOME/ovjbuild
runToolChain=1
Expand Down Expand Up @@ -110,6 +136,12 @@ else
cd ..
fi

if [[ $cloneOnly -eq 1 ]]; then
echo "Finished cloning repositories"
echo "Exiting"
exit 1
fi

cd bin
if [[ $runToolChain -eq 1 ]]; then
logFile=$HOME/ovjbuild/logs/toolChainLog
Expand Down

0 comments on commit 0ad7471

Please sign in to comment.