diff options
author | nachoparker <nacho@ownyourbits.com> | 2018-02-22 15:26:43 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-02-23 02:24:38 +0300 |
commit | 36a803f021b45864c6e609fd8c4eef1df6d75aa1 (patch) | |
tree | ea086346e491b6cc868c5971c9b84bf25094a63a /etc/nextcloudpi-config.d | |
parent | d05b06996155c96f0beb886fdea16d52bd65fa50 (diff) |
add ncp-provisioning to SD card imagesv0.46.30
Diffstat (limited to 'etc/nextcloudpi-config.d')
-rw-r--r-- | etc/nextcloudpi-config.d/nc-init.sh | 2 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-nextcloud.sh | 19 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-restore.sh | 2 |
3 files changed, 19 insertions, 4 deletions
diff --git a/etc/nextcloudpi-config.d/nc-init.sh b/etc/nextcloudpi-config.d/nc-init.sh index b8474ec3..725cd87f 100644 --- a/etc/nextcloudpi-config.d/nc-init.sh +++ b/etc/nextcloudpi-config.d/nc-init.sh @@ -56,7 +56,7 @@ configure() } # workaround to emulate DROP USER IF EXISTS ..;) - local DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 ) + local DBPASSWD=$( grep password /root/.my.cnf | sed 's|password=||' ) mysql <<EOF DROP DATABASE IF EXISTS nextcloud; CREATE DATABASE nextcloud diff --git a/etc/nextcloudpi-config.d/nc-nextcloud.sh b/etc/nextcloudpi-config.d/nc-nextcloud.sh index 94d1d4d6..38c5b5f1 100644 --- a/etc/nextcloudpi-config.d/nc-nextcloud.sh +++ b/etc/nextcloudpi-config.d/nc-nextcloud.sh @@ -62,7 +62,7 @@ install() $APTINSTALL redis-server php7.0-redis local REDIS_CONF=/etc/redis/redis.conf - local REDISPASS=$( openssl rand -base64 32 ) + local REDISPASS="default" sed -i "s|# unixsocket .*|unixsocket /var/run/redis/redis.sock|" $REDIS_CONF sed -i "s|# unixsocketperm .*|unixsocketperm 770|" $REDIS_CONF sed -i "s|# requirepass .*|requirepass $REDISPASS|" $REDIS_CONF @@ -85,6 +85,21 @@ install() systemctl start mysqld } + # service to randomize passwords on first boot + cat > /usr/lib/systemd/system/nc-provisioning.service <<'EOF' +[Unit] +Description=Randomize passwords on first boot +Requires=network.target +After=mysql.service + +[Service] +ExecStart=/bin/bash /usr/local/bin/ncp-provisioning.sh + +[Install] +WantedBy=multi-user.target +EOF + + [[ "$DOCKERBUILD" != 1 ]] && systemctl enable nc-provisioning return 0 } @@ -168,7 +183,7 @@ configure() echo "Setting up database..." # workaround to emulate DROP USER IF EXISTS ..;) - local DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 ) + local DBPASSWD=$( grep password /root/.my.cnf | sed 's|password=||' ) mysql <<EOF DROP DATABASE IF EXISTS nextcloud; CREATE DATABASE nextcloud diff --git a/etc/nextcloudpi-config.d/nc-restore.sh b/etc/nextcloudpi-config.d/nc-restore.sh index bb856ebb..e613cf32 100644 --- a/etc/nextcloudpi-config.d/nc-restore.sh +++ b/etc/nextcloudpi-config.d/nc-restore.sh @@ -30,7 +30,7 @@ You can use nc-backup" configure() { - local DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 ) + local DBPASSWD=$( grep password /root/.my.cnf | sed 's|password=||' ) [ -f $BACKUPFILE_ ] || { echo "$BACKUPFILE_ not found"; return 1; } [ -d /var/www/nextcloud ] && { echo "INFO: overwriting old instance" ; } |