grocy - add configuration with profile support
This commit is contained in:
3
seqs/grocy.cfg.example
Normal file
3
seqs/grocy.cfg.example
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sc_grocyDir="/var/www/grocy"
|
@@ -9,8 +9,7 @@ readonly versionUrl="https://api.github.com/repos/grocy/grocy/releases/latest"
|
||||
versionNew=
|
||||
versionNow=
|
||||
|
||||
sc_grocyDir="/var/www/grocy"
|
||||
sc_grocyConf="${sc_grocyDir}/data/config.php"
|
||||
sc_grocyConf=
|
||||
sc_grocyBackup="data/backup"
|
||||
sc_grocyViewcache="data/viewcache"
|
||||
|
||||
@@ -27,14 +26,15 @@ sq_aptOpt=
|
||||
sq_config=0
|
||||
|
||||
step_config() {
|
||||
## or to use sequencer api with global config file:
|
||||
#initSeqConfig "$sq_configFileName" "$sq_configFileTemplate"
|
||||
#if [ $? -eq 0 ] ; then
|
||||
# sq_config=1
|
||||
#else
|
||||
# # End if no configuration file exists
|
||||
# [ $DRY -eq 0 ] && return -1
|
||||
#fi
|
||||
initSeqConfig -p "$sq_scriptName" "$sq_configFileTemplate"
|
||||
if [ $? -eq 0 ] ; then
|
||||
sq_config=1
|
||||
else
|
||||
# End if no configuration file exists
|
||||
[ $DRY -eq 0 ] && return -1
|
||||
fi
|
||||
|
||||
sc_grocyConf="${sc_grocyDir}/data/config.php"
|
||||
|
||||
## Apt cmdline option to suppress user interaction
|
||||
[ $QUIET -ne 0 ] && sq_aptOpt="-y"
|
||||
@@ -45,7 +45,35 @@ step_config() {
|
||||
|
||||
getVersions() {
|
||||
versionNew=${versionNew:-$(curl --silent "$versionUrl" | grep -Po '"tag_name": "v\K.*?(?=")')}
|
||||
versionNow=${versionNow:-$(grep -Po '"Version": "\K.*?(?=")' < "${sc_grocyDir}/version.json")}
|
||||
versionNow=${versionNow:-$(grep -Po '"Version": "\K.*?(?=")' 2>/dev/null < "${sc_grocyDir}/version.json")}
|
||||
}
|
||||
|
||||
step_1_info() {
|
||||
echo "Check $toolName status"
|
||||
echoinfo "Returns 1 if update is available"
|
||||
}
|
||||
step_1_alias() { ALIAS="status"; }
|
||||
step_1() {
|
||||
getVersions
|
||||
if [ -e "${sc_grocyDir}" ] ; then
|
||||
echo
|
||||
echo "$toolName installed"
|
||||
echo " at: ${sc_grocyDir}"
|
||||
echo " version: ${versionNow}"
|
||||
echo " config: ${sc_grocyConf}"
|
||||
echo -n " update: "
|
||||
if [[ ! ${versionNow} = ${versionNew} ]] ; then
|
||||
echo "available: ${versionNew}}"
|
||||
return 1
|
||||
else
|
||||
echo "already on latest"
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
echo "$toolName not installed"
|
||||
echo "Version ${versionNew} available for installation"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
step_20_info() { echo "Backup ${toolName}"; }
|
||||
|
Reference in New Issue
Block a user