forked from ungleich-public/cdist-contrib
__nextcloud: fix shellcheck
Mostly simply because of php inline code .. also because of the argument generation for the installation setup.
This commit is contained in:
parent
979398e398
commit
0a0e4d26b4
4 changed files with 14 additions and 5 deletions
|
@ -5,7 +5,6 @@
|
|||
|
||||
|
||||
# Get the installdir
|
||||
user="$( cat "$__object/parameter/user" )"
|
||||
installdir="$( "$__type_explorer/installdir" )"
|
||||
|
||||
# Check if the tools are available
|
||||
|
@ -14,9 +13,11 @@ if [ -d "$installdir" ]; then
|
|||
|
||||
# if those files exist, everything should be good
|
||||
if [ -f "occ" ] && [ -f "config/config.php" ]; then
|
||||
# dump out config instead of fuzz every possible option through
|
||||
# Dump out config instead of fuzz every possible option through
|
||||
# `occ config:system:get`. Or parse through the whole json or
|
||||
# yaml-like output of `occ config:list system --private`.
|
||||
#
|
||||
# shellcheck disable=SC2016 # cause of the php inline code
|
||||
php -r 'require("lib/private/Config.php"); $config = new OC\Config("config/");
|
||||
function printv($key, $value) {printf("%s = %s\n", $key, $value);}
|
||||
foreach($config->getKeys() as $key){
|
||||
|
|
|
@ -13,7 +13,8 @@ if [ -d "$installdir" ]; then
|
|||
|
||||
# if those files exist, everything should be good
|
||||
if [ -f "occ" ] && [ -f "version.php" ]; then
|
||||
# detect php version with the version file
|
||||
# Detect php version with the version file.
|
||||
# shellcheck disable=SC2016 # cause of the php inline code
|
||||
php -r 'require("version.php"); print($OC_VersionString);'
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -91,6 +91,8 @@ fi
|
|||
|
||||
# Check if the nextcloud application needs to be installed.
|
||||
# This checks the state of the configuration, not of the directory.
|
||||
#
|
||||
# shellcheck disable=SC2089 # disabled to write args string
|
||||
if ! grep -q -F "installed = 1" "$__object/explorer/config"; then
|
||||
# argument construction
|
||||
occ_install_args=""
|
||||
|
@ -159,8 +161,9 @@ if ! grep -q -F "installed = 1" "$__object/explorer/config"; then
|
|||
fi
|
||||
|
||||
|
||||
# Execute the install command
|
||||
occ maintenance:install $occ_install_args
|
||||
# Execute the install command.
|
||||
# generated parameters will be splited in the remote shell
|
||||
occ maintenance:install "$occ_install_args"
|
||||
|
||||
# send install message
|
||||
echo installed >> "$__messages_out"
|
||||
|
|
|
@ -57,6 +57,7 @@ conf_base() {
|
|||
value="$(cat "$__object/parameter/$1")"
|
||||
if ! testparam "$2" "$value"; then
|
||||
# set it because it does not exist
|
||||
# shellcheck disable=SC2059 # $3 contains patterns
|
||||
printf "php occ config:system:$3\n" "$2" "$value"
|
||||
fi
|
||||
else
|
||||
|
@ -122,6 +123,7 @@ conf_array() {
|
|||
# else, default behaviour of the array
|
||||
else
|
||||
# save counter of the next free index
|
||||
# shellcheck disable=SC1004 # the \ is required for awk
|
||||
counter=$( awk -v FS=" = " -v name="$2" '
|
||||
BEGIN { counter = 0 }
|
||||
split($1, header, "|") == 2 && header[1] ~ /^[[:digit:]]+$/ && header[2] == name \
|
||||
|
@ -156,6 +158,8 @@ conf_array() {
|
|||
if [ -z "$install" ]; then
|
||||
# interate through the leftover values
|
||||
# remove them, as they should not exist (at least can be)
|
||||
#
|
||||
# shellcheck disable=SC2034 # $equal left for readability
|
||||
while read -r start equal value; do
|
||||
# remove those specific elements from the array
|
||||
printf "php occ config:system:delete '%s' '%s' --error-if-not-exists\n" \
|
||||
|
|
Loading…
Reference in a new issue