Skip to content

Allow custom script execution on installation#1260

Closed
mgerhardy wants to merge 3 commits intonextcloud:masterfrom
mgerhardy:pr/custom-script-execution
Closed

Allow custom script execution on installation#1260
mgerhardy wants to merge 3 commits intonextcloud:masterfrom
mgerhardy:pr/custom-script-execution

Conversation

@mgerhardy
Copy link
Contributor

Should fix issues

This allows a custom script to be mounted as docker or kubernetes volume to be executed. This can be used to execute all kind of occ commands.

Alternative and more customizable to the PR #1259

@mgerhardy
Copy link
Contributor Author

mgerhardy commented Oct 5, 2020

one could e.g. do

#!/bin/sh

occ() {
    php /var/www/html/occ $@
}

# loginname, display name, email, password
createuser() {
    export OC_PASS="$4"
    occ user:add --password-from-env --display-name="$2" "$1"
    unset OC_PASS
    occ user:setting "$1" email "$3"
}

for app in contacts calendar; do
    occ app:install -n $app
done

createuser user1 "User 1" "user@domain.com" "secrets-mounted-as-docker-or-k8s-secret"

mount this to /tmp/configure.sh and set NEXTCLOUD_CUSTOM_INSTALL_SCRIPT to /tmp/configure.sh

fi

if [ -n "${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT+x}" ]; then
run_as "/bin/sh ${NEXTCLOUD_CUSTOM_INSTALL_SCRIPT}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this but are there any common use cases where you don't want to run_as limited user?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only use case I see may be adding distrib packages, but I think that building a custom image is better here.

@J0WI
Copy link
Contributor

J0WI commented Nov 28, 2021

@mgerhardy would you like to rebase this?

@ghost
Copy link

ghost commented Dec 17, 2021

Hi,

Any news @mgerhardy ?

@ghost
Copy link

ghost commented Jan 8, 2022

Hi,

@mgerhardy, do you need any help ?

Thank ! ;)

@skjnldsv
Copy link
Member

See #1683

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants