This shows you the differences between two versions of the page.
| — |
userspace:updatefoxitreader [2022/02/14 14:10] (current) Thomas_H created |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== updateFoxitReader ===== | ||
| + | By // | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | # | ||
| + | ############################################################################## | ||
| + | # first we declare some variables. A good programmer is a lazy programmer :) | ||
| + | ############################################################################## | ||
| + | opsiproduct_path="/ | ||
| + | product=" | ||
| + | setupname=" | ||
| + | geturl=" | ||
| + | urladd="/ | ||
| + | # Attention! following grepvar-string is a regular expression!! Leave the [^"]* at the end!! | ||
| + | grepvar="" | ||
| + | searchstr="" | ||
| + | alt_ver=$(date +" | ||
| + | # Where is the first digit of the version-number? | ||
| + | startpos=0 | ||
| + | ############################################################################## | ||
| + | # | ||
| + | # | ||
| + | # first, let's remove the last valid exe-file | ||
| + | # --- rm $opsiproduct_path/ | ||
| + | # 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 [ " | ||
| + | setupprg=$setupname | ||
| + | else | ||
| + | setupprg=$( wget --no-check-certificate $geturl -q -O- | grep -o $grepvar ) | ||
| + | fi | ||
| + | |||
| + | echo setupprg=$setupprg | ||
| + | wget --no-check-certificate " | ||
| + | # let's change the directory to the package | ||
| + | cd $opsiproduct_path/ | ||
| + | # 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=":" | ||
| + | # 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 / | ||
| + | sed " | ||
| + | mv $opsiproduct_path/ | ||
| + | # make new package, but quiet | ||
| + | opsi-makepackage -q | ||
| + | opsi-package-manager -i *.opsi | ||
| + | </ | ||