User Tools

Site Tools


userspace:updatecdburnerxp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

userspace:updatecdburnerxp [2022/02/14 14:08] (current)
Thomas_H created
Line 1: Line 1:
 +===== updateCDBurnerXP =====
 +By  //[[hungerharke@gmx.de|Thomas_H]] 2021/02/14//
  
 +<code>
 +#!/bin/bash
 +#
 +##############################################################################
 +# first we declare some variables. A good programmer is a lazy programmer :)
 +##############################################################################
 +opsiproduct_path="/home/opsiproducts"                # as recommended by uib it's always /home/opsiproducts
 +product="cdburnerxp"                                   # just an example
 +setupname="cdburnerxp_x64_setup.exe"                   # just an example
 +geturl="https://cdburnerxp.se"  # move the rest beginning from the last slash to var urladd!
 +urladd="/downloadsetup.exe?x64" # minimum a slash / we add this at the end of $geturl
 +# Attention! following grepvar-string is a regular expression!! Leave the [^"]* at the end!!
 +grepvar=""
 +searchstr=""
 +alt_ver=$(date +"%y%m%d")
 +# Where is the first digit of the version-number?
 +startpos=0
 +##############################################################################
 +#
 +#
 +# first, let's remove the last valid exe-file
 +rm $opsiproduct_path/$product/CLIENT_DATA/$setupname
 +# get the new setup-file from website and rename it to a standard file name (so no need to change the setup.ins :P )
 +
 +if [ "$grepvar" == "" ]; then
 +    setupprg=$setupname
 +else
 +    setupprg=$( wget --no-check-certificate $geturl -q -O- | grep -o $grepvar )
 +fi
 +
 +echo setupprg=$setupprg
 +wget --no-check-certificate "$geturl$urladd$setupprg" -O $opsiproduct_path/$product/CLIENT_DATA/$setupname
 +# let's change the directory to the package
 +cd $opsiproduct_path/$product/
 +# remove the *.opsi-files
 +rm *.opsi
 +rm *.zsync
 +rm *.md5
 +# to find out, which version it is, we do a little bit of awk
 +if [ $startpos != 0 ]; then
 +    pos=$(echo $setupprg | grep -b -o $searchstr | awk 'BEGIN {FS=":"}{print $1}')
 +    # well done, we found it.
 +    version=$(echo $setupprg | cut -c$startpos-$pos)
 +else
 +    version=$alt_ver
 +fi
 +echo Version=$version
 +# now let's change the /OPSI/control file
 +sed "s/version:.*/version: $version /g" $opsiproduct_path/$product/OPSI/control > $opsiproduct_path/$product/OPSI/control.new
 +mv $opsiproduct_path/$product/OPSI/control.new $opsiproduct_path/$product/OPSI/control
 +# make new package, but quiet
 +opsi-makepackage -q
 +opsi-package-manager -i *.opsi
 +</code>
userspace/updatecdburnerxp.txt ยท Last modified: 2022/02/14 14:08 by Thomas_H