Gitlab Community Edition Instance

Commit d00731fd authored by Bjoern Nachtwey's avatar Bjoern Nachtwey
Browse files

a bash script for automatically get newest version of dsmci.pl

parent e9182e03
#! /bin/bash
#############################################################################
#
# get_newest_dsmci.sh
#
# script for retrieving the newest version of dsmci.pl from GWDG gitlab
# -- limited depth approach
#
# (C) 2022 GWDG Göttingen, Bjørn Nachtwey
# mailto:bjoern.nachtwey@gwdg.de
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# changelog
# date version remark
# 2022-03-14 0.1 initial coding using bash
if [ "$#" -ne 1 ]
then
echo "usage: get_newest_dsmci.sh <path where to copy new version of dsmci.pl>"
fi
# remote and local path
URL="https://gitlab.gwdg.de/bnachtw/dsmci/-/raw/master/perl/dsmci.pl"
tpath=/tmp/dsmci.pl
lpath=$1
# remove old copy (regardless of whether there is one)
rm -f /tmp/dsmci*
# get actual copy from gitlab
cd /tmp
wget -q $URL $tpath
# file was downloaded and isn't empty
if [ -s $tpath ]
then
# look for differences with the already existing one
diff -q $tpath $lpath
diffrc=$?
# check if files differ
if [ $diffrc -ne 0 ]
then
echo "files do differ: copy new one"
mv -f $tpath $lpath
chmod +x $lpath
else
echo "files do not differ: remove downloaded copy"
rm $tpath
fi
else
exit 1;
fi
exit
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment