Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom script execution on installation #1260

Closed

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

@@ -168,6 +168,10 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
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?

@Loxeno
Copy link

Loxeno commented Dec 17, 2021

Hi,

Any news @mgerhardy ?

@Loxeno
Copy link

Loxeno 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.

4 participants