Skip to content

Commit

Permalink
support for utf8 4byte char
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jun 28, 2017
1 parent ecedf91 commit c03bb6f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
14 changes: 11 additions & 3 deletions etc/nc-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ DBPASSWD_=ownyourbits

install()
{
# RE-CREATE DATABASE TABLE (workaround to emulate DROP USER IF EXISTS ..;)
## RE-CREATE DATABASE TABLE (workaround to emulate DROP USER IF EXISTS ..;)

echo "Setting up database..."

Expand All @@ -33,15 +33,17 @@ install()

mysql -u root -p$DBPASSWD_ <<EOF
DROP DATABASE IF EXISTS nextcloud;
CREATE DATABASE nextcloud;
CREATE DATABASE nextcloud
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
GRANT USAGE ON *.* TO '$DBADMIN_'@'localhost' IDENTIFIED BY '$DBPASSWD_';
DROP USER '$DBADMIN_'@'localhost';
CREATE USER '$DBADMIN_'@'localhost' IDENTIFIED BY '$DBPASSWD_';
GRANT ALL PRIVILEGES ON nextcloud.* TO $DBADMIN_@localhost;
EXIT
EOF

# INITIALIZE NEXTCLOUD
## INITIALIZE NEXTCLOUD

echo "Setting up Nextcloud..."

Expand All @@ -50,8 +52,14 @@ EOF
"mysql" --database-name "nextcloud" --database-user "$DBADMIN_" --database-pass \
"$DBPASSWD_" --admin-user "$ADMINUSER_" --admin-pass "$DBPASSWD_"

# cron jobs
sudo -u www-data php occ background:cron

# ACPu cache
sed -i '$i\ \ '\''memcache.local'\'' => '\''\\\\OC\\\\Memcache\\\\APCu'\'',' /var/www/nextcloud/config/config.php

# 4 Byte UTF8 support
sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true"
}

configure(){ :; }
Expand Down
4 changes: 3 additions & 1 deletion installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ IMGFILE=$3 # Third argument is the image file to start from ( empty

source etc/library.sh # initializes $IMGNAME

test -f $IMGNAME && { echo "INFO: $IMGNAME already exists. Skip generation ... "; exit 0; }

config $INSTALL_SCRIPT || exit 1 # Initializes $INSTALLATION_CODE

if [[ "$IMGFILE" != "" ]]; then
launch_install_qemu "$IMGFILE" $IP || { sudo killall qemu-system-arm; exit 1; } # initializes $IMGOUT
launch_install_qemu "$IMGFILE" $IP || { sudo killall qemu-system-arm; exit 1; } # initializes $IMGOUT
pack_image "$IMGOUT" "$IMGNAME"
else
launch_installation_online $IP
Expand Down
10 changes: 9 additions & 1 deletion lamp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ EOF
mkdir -p /run/mysqld
chown mysql /run/mysqld

# CONFIGURE APACHE AND PHP7
# CONFIGURE APACHE
##########################################

cat >/etc/apache2/conf-available/http2.conf <<EOF
Expand All @@ -78,6 +78,9 @@ EOF
</IfModule>
EOF

# CONFIGURE PHP7
##########################################

cat > /etc/php/7.0/mods-available/apcu.ini <<EOF
extension=apcu.so
apc.enable_cli=0
Expand Down Expand Up @@ -120,6 +123,11 @@ EOF

$APTINSTALL ssl-cert # self signed snakeoil certs

# configure MariaDB ( UTF8 4 byte support )
sed -i '/\[mysqld\]/ainnodb_large_prefix=on' /etc/mysql/mariadb.conf.d/50-server.cnf
sed -i '/\[mysqld\]/ainnodb_file_per_table=1' /etc/mysql/mariadb.conf.d/50-server.cnf
sed -i '/\[mysqld\]/ainnodb_file_format=barracuda' /etc/mysql/mariadb.conf.d/50-server.cnf

cat > /etc/apache2/sites-available/nextcloud.conf <<'EOF'
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
Expand Down

0 comments on commit c03bb6f

Please sign in to comment.