Update arch_install.sh
This commit is contained in:
parent
f40c00d7cc
commit
c9d302fe44
|
|
@ -37,11 +37,15 @@ SMB_FSTAB_OPTIONS="rw,credentials=${SMB_CREDENTIALS_FILE},uid=http,gid=http,ioch
|
||||||
# INTERNALS
|
# INTERNALS
|
||||||
########################################
|
########################################
|
||||||
|
|
||||||
PHP_INI="/etc/php-legacy/php.ini"
|
PHP_ETC_DIR="/etc/php-legacy"
|
||||||
|
PHP_INI="${PHP_ETC_DIR}/php.ini"
|
||||||
|
PHP_CONF_D="${PHP_ETC_DIR}/conf.d"
|
||||||
PHP_FPM_POOL_CONF="/etc/php-legacy/php-fpm.d/www.conf"
|
PHP_FPM_POOL_CONF="/etc/php-legacy/php-fpm.d/www.conf"
|
||||||
|
|
||||||
HTTPD_CONF="/etc/httpd/conf/httpd.conf"
|
HTTPD_CONF="/etc/httpd/conf/httpd.conf"
|
||||||
HTTPD_NEXTCLOUD_CONF="/etc/httpd/conf/extra/nextcloud.conf"
|
HTTPD_NEXTCLOUD_CONF="/etc/httpd/conf/extra/nextcloud.conf"
|
||||||
HTTPD_WELLKNOWN_CONF="/etc/httpd/conf/extra/nextcloud-wellknown.conf"
|
HTTPD_WELLKNOWN_CONF="/etc/httpd/conf/extra/nextcloud-wellknown.conf"
|
||||||
|
|
||||||
VALKEY_CONF="/etc/valkey/valkey.conf"
|
VALKEY_CONF="/etc/valkey/valkey.conf"
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
|
|
@ -80,8 +84,16 @@ ensure_line() {
|
||||||
grep -Fqx "$line" "$file" || echo "$line" >> "$file"
|
grep -Fqx "$line" "$file" || echo "$line" >> "$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write_ini() {
|
||||||
|
local file="$1"
|
||||||
|
shift
|
||||||
|
cat > "$file" <<EOF
|
||||||
|
$*
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
occ() {
|
occ() {
|
||||||
sudo -u "${APACHE_RUN_USER}" php-legacy "${NEXTCLOUD_WEBROOT}/occ" "$@"
|
sudo -u "${APACHE_RUN_USER}" /usr/bin/php-legacy /usr/bin/occ "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
|
|
@ -125,10 +137,11 @@ pacman -S --needed --noconfirm \
|
||||||
log "Creating base directories"
|
log "Creating base directories"
|
||||||
|
|
||||||
mkdir -p "${NEXTCLOUD_DATA_DIR}"
|
mkdir -p "${NEXTCLOUD_DATA_DIR}"
|
||||||
|
mkdir -p /var/lib/nextcloud
|
||||||
mkdir -p /var/log/httpd
|
mkdir -p /var/log/httpd
|
||||||
mkdir -p /run/httpd
|
mkdir -p /run/httpd
|
||||||
|
mkdir -p "${PHP_CONF_D}"
|
||||||
|
|
||||||
mkdir -p /var/lib/nextcloud
|
|
||||||
chown -R "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" /var/lib/nextcloud
|
chown -R "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" /var/lib/nextcloud
|
||||||
chmod 0750 /var/lib/nextcloud
|
chmod 0750 /var/lib/nextcloud
|
||||||
chmod 0750 "${NEXTCLOUD_DATA_DIR}"
|
chmod 0750 "${NEXTCLOUD_DATA_DIR}"
|
||||||
|
|
@ -181,6 +194,36 @@ replace_or_append_ini "output_buffering" "Off" "${PHP_INI}"
|
||||||
replace_or_append_ini "date.timezone" "${PHP_TIMEZONE}" "${PHP_INI}"
|
replace_or_append_ini "date.timezone" "${PHP_TIMEZONE}" "${PHP_INI}"
|
||||||
replace_or_append_ini "cgi.fix_pathinfo" "0" "${PHP_INI}"
|
replace_or_append_ini "cgi.fix_pathinfo" "0" "${PHP_INI}"
|
||||||
|
|
||||||
|
# Explicitly enable extensions needed by Nextcloud.
|
||||||
|
# Arch php-legacy package layout is module-based, so make sure conf.d loads them.
|
||||||
|
write_ini "${PHP_CONF_D}/20-nextcloud-core.ini" \
|
||||||
|
"; Core DB and image modules for Nextcloud
|
||||||
|
extension=mysqli
|
||||||
|
extension=pdo_mysql
|
||||||
|
extension=gd
|
||||||
|
extension=intl
|
||||||
|
extension=sodium
|
||||||
|
"
|
||||||
|
|
||||||
|
write_ini "${PHP_CONF_D}/20-nextcloud-cache.ini" \
|
||||||
|
"; Cache modules for Nextcloud
|
||||||
|
extension=apcu
|
||||||
|
extension=redis
|
||||||
|
apc.enable_cli=1
|
||||||
|
"
|
||||||
|
|
||||||
|
write_ini "${PHP_CONF_D}/10-opcache.ini" \
|
||||||
|
"; Opcache
|
||||||
|
zend_extension=opcache
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.interned_strings_buffer=16
|
||||||
|
opcache.max_accelerated_files=10000
|
||||||
|
opcache.memory_consumption=192
|
||||||
|
opcache.save_comments=1
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
"
|
||||||
|
|
||||||
sed -ri 's|^user\s*=.*|user = http|g' "${PHP_FPM_POOL_CONF}"
|
sed -ri 's|^user\s*=.*|user = http|g' "${PHP_FPM_POOL_CONF}"
|
||||||
sed -ri 's|^group\s*=.*|group = http|g' "${PHP_FPM_POOL_CONF}"
|
sed -ri 's|^group\s*=.*|group = http|g' "${PHP_FPM_POOL_CONF}"
|
||||||
|
|
||||||
|
|
@ -209,12 +252,12 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl enable --now php-fpm-legacy
|
systemctl enable --now php-fpm-legacy
|
||||||
|
systemctl restart php-fpm-legacy
|
||||||
|
|
||||||
log "Configuring Valkey (TCP localhost only)"
|
log "Configuring Valkey (TCP localhost only)"
|
||||||
|
|
||||||
backup_file "${VALKEY_CONF}"
|
backup_file "${VALKEY_CONF}"
|
||||||
|
|
||||||
# Avoid unix socket issues entirely; listen only on localhost
|
|
||||||
if grep -Eq '^[#[:space:]]*bind ' "${VALKEY_CONF}"; then
|
if grep -Eq '^[#[:space:]]*bind ' "${VALKEY_CONF}"; then
|
||||||
sed -ri 's|^[#[:space:]]*bind .*|bind 127.0.0.1 ::1|g' "${VALKEY_CONF}"
|
sed -ri 's|^[#[:space:]]*bind .*|bind 127.0.0.1 ::1|g' "${VALKEY_CONF}"
|
||||||
else
|
else
|
||||||
|
|
@ -233,7 +276,6 @@ else
|
||||||
echo "protected-mode yes" >> "${VALKEY_CONF}"
|
echo "protected-mode yes" >> "${VALKEY_CONF}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable unix socket lines to prevent service start issues
|
|
||||||
sed -ri 's|^[#[:space:]]*unixsocket .*|# unixsocket disabled by install script|g' "${VALKEY_CONF}" || true
|
sed -ri 's|^[#[:space:]]*unixsocket .*|# unixsocket disabled by install script|g' "${VALKEY_CONF}" || true
|
||||||
sed -ri 's|^[#[:space:]]*unixsocketperm .*|# unixsocketperm disabled by install script|g' "${VALKEY_CONF}" || true
|
sed -ri 's|^[#[:space:]]*unixsocketperm .*|# unixsocketperm disabled by install script|g' "${VALKEY_CONF}" || true
|
||||||
|
|
||||||
|
|
@ -350,10 +392,23 @@ if [[ "${ENABLE_SMB_MOUNT}" == "true" ]]; then
|
||||||
chown "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" "${SMB_MOUNTPOINT}" || true
|
chown "${APACHE_RUN_USER}:${APACHE_RUN_GROUP}" "${SMB_MOUNTPOINT}" || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
log "Verifying PHP modules before install"
|
||||||
|
|
||||||
|
php-legacy -m | grep -qi '^gd$' || die "PHP GD module is still not loaded."
|
||||||
|
php-legacy -m | grep -qi '^mysqli$' || die "PHP mysqli module is still not loaded."
|
||||||
|
php-legacy -m | grep -qi '^PDO$' || die "PHP PDO core is still not loaded."
|
||||||
|
php-legacy -m | grep -qi '^pdo_mysql$' || die "PHP pdo_mysql module is still not loaded."
|
||||||
|
php-legacy -m | grep -qi '^intl$' || die "PHP intl module is still not loaded."
|
||||||
|
php-legacy -m | grep -qi '^redis$' || die "PHP redis module is still not loaded."
|
||||||
|
php-legacy -m | grep -qi '^apcu$' || die "PHP apcu module is still not loaded."
|
||||||
|
|
||||||
|
systemctl restart php-fpm-legacy
|
||||||
|
systemctl restart httpd
|
||||||
|
|
||||||
log "Installing Nextcloud non-interactively"
|
log "Installing Nextcloud non-interactively"
|
||||||
|
|
||||||
if [[ ! -f "${NEXTCLOUD_CONFIG_DIR}/config/config.php" ]] || grep -q "CAN_INSTALL" "${NEXTCLOUD_CONFIG_DIR}/config/config.php" 2>/dev/null; then
|
if [[ ! -f "${NEXTCLOUD_CONFIG_DIR}/config/config.php" ]] || grep -q "CAN_INSTALL" "${NEXTCLOUD_CONFIG_DIR}/config/config.php" 2>/dev/null; then
|
||||||
sudo -u "${APACHE_RUN_USER}" php-legacy "${NEXTCLOUD_WEBROOT}/occ" maintenance:install \
|
sudo -u "${APACHE_RUN_USER}" /usr/bin/php-legacy /usr/bin/occ maintenance:install \
|
||||||
--database "mysql" \
|
--database "mysql" \
|
||||||
--database-name "${DB_NAME}" \
|
--database-name "${DB_NAME}" \
|
||||||
--database-user "${DB_USER}" \
|
--database-user "${DB_USER}" \
|
||||||
|
|
@ -385,6 +440,7 @@ occ config:system:set maintenance_window_start --type=integer --value=1 || true
|
||||||
log "Enabling cron"
|
log "Enabling cron"
|
||||||
|
|
||||||
systemctl enable --now nextcloud-cron.service || true
|
systemctl enable --now nextcloud-cron.service || true
|
||||||
|
systemctl enable --now nextcloud-cron.timer || true
|
||||||
|
|
||||||
log "Final service restarts"
|
log "Final service restarts"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue