Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornachoparker <nacho@ownyourbits.com>2017-11-22 19:09:44 +0300
committernachoparker <nacho@ownyourbits.com>2017-11-22 21:26:29 +0300
commit6883aa2da7cd91df8eb849170fa3125b60c27a70 (patch)
treeca9e504ab2c9bfa6228b8180e226d6d2193849d5
parent6fe08e6858fcef17ec052e4a679d90dbcb8d1962 (diff)
added armbian support
-rw-r--r--armbian.sh58
-rw-r--r--docker-armhf/nextcloudpi/Dockerfile4
-rw-r--r--docker/nextcloudpi/Dockerfile4
-rw-r--r--etc/nextcloudpi-config.d/nc-init.sh42
-rw-r--r--etc/nextcloudpi-config.d/nc-nextcloud.sh8
-rw-r--r--install.sh12
-rw-r--r--lamp.sh9
-rw-r--r--nextcloudpi.sh4
-rw-r--r--prepare.sh3
-rwxr-xr-xupdate.sh6
10 files changed, 129 insertions, 21 deletions
diff --git a/armbian.sh b/armbian.sh
new file mode 100644
index 00000000..80d217b4
--- /dev/null
+++ b/armbian.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# arguments: $RELEASE $LINUXFAMILY $BOARD $BUILD_DESKTOP
+
+# This is the image customization script for NextCloudPi on Armbian
+#
+# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>
+# GPL licensed (see end of file) * Use at your own risk!
+#
+# More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/
+#
+
+
+RELEASE=$1
+LINUXFAMILY=$2
+BOARD=$3
+BUILD_DESKTOP=$4
+
+Main() {
+ case $RELEASE in
+ jessie)
+ # your code here
+ ;;
+ xenial)
+ # your code here
+ ;;
+ stretch)
+ # Need sudo access that does not expire
+ echo -e "1234\n1234" | passwd root
+
+ # indicate that this will be an image build
+ touch /.ncp-image
+
+ # install NCP
+ curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash
+
+ ;;
+ esac
+} # Main
+
+Main "$@"
+
+# License
+#
+# This script is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This script is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this script; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+# Boston, MA 02111-1307 USA
diff --git a/docker-armhf/nextcloudpi/Dockerfile b/docker-armhf/nextcloudpi/Dockerfile
index 7d7d21cd..f62ceec5 100644
--- a/docker-armhf/nextcloudpi/Dockerfile
+++ b/docker-armhf/nextcloudpi/Dockerfile
@@ -9,6 +9,9 @@ ENV DOCKERBUILD 1
COPY nextcloudpi.sh /usr/local/etc/
RUN \
+# mark as image build
+touch /.ncp-image; \
+
apt-get update; \
apt-get install --no-install-recommends -y wget ca-certificates; \
@@ -23,6 +26,7 @@ sed -i 's|/media/USBdrive|/data/backups|' nextcloudpi-config.d/nc-backup.sh; \
# specific cleanup
rm /usr/local/etc/nextcloudpi.sh; \
+rm /.ncp-image; \
# remove wizard for now
rm -r /var/www/ncp-web/wizard; \
diff --git a/docker/nextcloudpi/Dockerfile b/docker/nextcloudpi/Dockerfile
index add24736..d80ec758 100644
--- a/docker/nextcloudpi/Dockerfile
+++ b/docker/nextcloudpi/Dockerfile
@@ -9,6 +9,9 @@ ENV DOCKERBUILD 1
COPY nextcloudpi.sh /usr/local/etc/
RUN \
+# mark as image build
+touch /.ncp-image; \
+
apt-get update; \
apt-get install --no-install-recommends -y wget ca-certificates; \
@@ -23,6 +26,7 @@ sed -i 's|/media/USBdrive|/data/backups|' nextcloudpi-config.d/nc-backup.sh; \
# specific cleanup
rm /usr/local/etc/nextcloudpi.sh; \
+rm /.ncp-image; \
# remove wizard for now
rm -r /var/www/ncp-web/wizard; \
diff --git a/etc/nextcloudpi-config.d/nc-init.sh b/etc/nextcloudpi-config.d/nc-init.sh
index d06d4953..61370ccd 100644
--- a/etc/nextcloudpi-config.d/nc-init.sh
+++ b/etc/nextcloudpi-config.d/nc-init.sh
@@ -34,13 +34,20 @@ configure()
echo "Setting up database..."
- # wait for mariadb
+ # launch mariadb if not already running
+ if ! pgrep -c mysqld &>/dev/null; then
+ mysqld &
+ fi
+
pgrep -x mysqld &>/dev/null || { echo "mariaDB process not found"; return 1; }
- while :; do
- [[ -S /var/run/mysqld/mysqld.sock ]] && break
- sleep 0.5
- done
+ # wait for mariadb
+ # TODO FIXME armbian build
+ #while :; do
+ #[[ -S /run/mysqld/mysqld.sock ]] && break
+ #sleep 0.5
+ #done
+ sleep 10
# workaround to emulate DROP USER IF EXISTS ..;)
local DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 )
@@ -58,6 +65,19 @@ EOF
## INITIALIZE NEXTCLOUD
+ # make sure redis is running first
+ if ! pgrep -c redis-server &>/dev/null; then
+ mkdir -p /var/run/redis
+ chown redis /var/run/redis
+ sudo -u redis redis-server /etc/redis/redis.conf &
+ fi
+
+ while :; do
+ [[ -S /run/redis/redis.sock ]] && break
+ sleep 0.5
+ done
+
+
echo "Setting up Nextcloud..."
cd /var/www/nextcloud/
@@ -87,7 +107,7 @@ EOF
sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true"
# Default trusted domain ( only from nextcloudpi-config )
- test -f /usr/local/bin/nextcloud-domain.sh && bash /usr/local/bin/nextcloud-domain.sh
+ test -f /.ncp-image || bash /usr/local/bin/nextcloud-domain.sh
sudo -u www-data php occ config:system:set trusted_domains 5 --value="nextcloudpi.local"
# email
@@ -104,11 +124,11 @@ EOF
chown -R www-data:www-data data/appdata_${ID}
mysql nextcloud <<EOF
-replace into oc_appconfig values ( 'theming', 'name', "NextCloudPi" );
-replace into oc_appconfig values ( 'theming', 'slogan', "keep your data close" );
-replace into oc_appconfig values ( 'theming', 'url', "https://ownyourbits.com" );
-replace into oc_appconfig values ( 'theming', 'logoMime', "image/svg+xml" );
-replace into oc_appconfig values ( 'theming', 'backgroundMime', "image/png" );
+replace into oc_appconfig values ( 'theming', 'name' , "NextCloudPi" );
+replace into oc_appconfig values ( 'theming', 'slogan' , "keep your data close" );
+replace into oc_appconfig values ( 'theming', 'url' , "https://ownyourbits.com" );
+replace into oc_appconfig values ( 'theming', 'logoMime' , "image/svg+xml" );
+replace into oc_appconfig values ( 'theming', 'backgroundMime', "image/png" );
EOF
# NCP notifications
diff --git a/etc/nextcloudpi-config.d/nc-nextcloud.sh b/etc/nextcloudpi-config.d/nc-nextcloud.sh
index db99dc07..4623bd26 100644
--- a/etc/nextcloudpi-config.d/nc-nextcloud.sh
+++ b/etc/nextcloudpi-config.d/nc-nextcloud.sh
@@ -42,7 +42,7 @@ install()
# Optional packets for Nextcloud and Apps
apt-get update
$APTINSTALL -o "Dpkg::Options::=--force-confold" php-smbclient
- $APTINSTALL postfix lbzip2 iputils-ping
+ $APTINSTALL postfix lbzip2 iputils-ping || true
# REDIS
$APTINSTALL redis-server php7.0-redis
@@ -54,7 +54,7 @@ install()
echo "maxmemory ${REDIS_MEM}" >> $REDIS_CONF
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
- sudo usermod -a -G redis www-data
+ usermod -a -G redis www-data
[[ "$DOCKERBUILD" != 1 ]] && {
systemctl restart redis-server
@@ -77,7 +77,9 @@ configure()
echo "Starting mariaDB"
# launch mariadb if not already running (for docker build)
- [[ "$DOCKERBUILD" == 1 ]] && { mysqld & }
+ if ! pgrep -c mysqld &>/dev/null; then
+ mysqld &
+ fi
# wait for mariadb
pgrep -x mysqld &>/dev/null || { echo "mariaDB process not found"; return 1; }
diff --git a/install.sh b/install.sh
index 683d7388..4d91eaeb 100644
--- a/install.sh
+++ b/install.sh
@@ -53,10 +53,18 @@ activate_script etc/nextcloudpi-config.d/nc-init.sh
[[ "$APACHE_EXISTS" != "" ]] && \
a2enmod status reqtimeout env autoindex access_compat auth_basic authn_file authn_core alias access_compat
-# cleanup
cd -
rm -rf $TMPDIR
+# extra cleanup only in image generation
+[[ -f /.ncp-image ]] && {
+ apt-get autoremove -y
+ apt-get clean
+ rm /var/lib/apt/lists/* -r
+ rm /.ncp-image
+}
+
+
echo "Done.
Type 'sudo nextcloudpi-config' to configure NCP
@@ -66,6 +74,8 @@ Access NextCloudPi panel on nextcloudpi.local:4443
Access Nextcloud on nextcloudpi.local
"
+exit 0
+
# License
#
# This script is free software; you can redistribute it and/or modify it
diff --git a/lamp.sh b/lamp.sh
index e78c9562..748a3a4e 100644
--- a/lamp.sh
+++ b/lamp.sh
@@ -111,14 +111,17 @@ EOF
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
- # launch mariadb if not already running (for docker build)
- [[ "$DOCKERBUILD" == 1 ]] && { mysqld & }
+ # launch mariadb if not already running
+ if ! pgrep -c mysqld &>/dev/null; then
+ mysqld &
+ fi
# wait for mariadb
while :; do
- [[ -S /var/run/mysqld/mysqld.sock ]] && break
+ [[ -S /run/mysqld/mysqld.sock ]] && break
sleep 0.5
done
+
mysql_secure_installation <<EOF
$DBPASSWD
n
diff --git a/nextcloudpi.sh b/nextcloudpi.sh
index a7141e9f..d07325f5 100644
--- a/nextcloudpi.sh
+++ b/nextcloudpi.sh
@@ -173,7 +173,7 @@ EOF
/usr/local/bin/ncp-update
# ONLY FOR IMAGE BUILDS
- if [[ "$IMGBUILD" == 1 ]]; then
+ if [[ -f /.ncp-image ]]; then
## NEXTCLOUDPI MOTD
rm -rf /etc/update-motd.d
@@ -246,6 +246,8 @@ EOF
chmod +x /etc/init.d/resize2fs_once
systemctl enable resize2fs_once
+ rm /.ncp-image
+
systemctl disable ssh
}
diff --git a/prepare.sh b/prepare.sh
index 9075d665..da09c8f9 100644
--- a/prepare.sh
+++ b/prepare.sh
@@ -17,6 +17,9 @@ install()
test -f $STATE_FILE && STATE=$( cat $STATE_FILE 2>/dev/null )
if [ "$STATE" == "" ]; then
+ # MARK THE IMAGE AS AN IMAGE BUILD
+ touch /.ncp-image
+
# RESIZE IMAGE
##########################################
diff --git a/update.sh b/update.sh
index 260c8ef0..523c2e2c 100755
--- a/update.sh
+++ b/update.sh
@@ -112,7 +112,8 @@ done
## BACKWARD FIXES ( for older images )
-[[ "$DOCKERBUILD" != 1 ]] && {
+# only for image builds
+[[ ! -f /.ncp-image ]] && {
# fix notify unattended upgrades repeating lines
cat > /usr/local/bin/ncp-notify-unattended-upgrade <<EOF
@@ -291,9 +292,10 @@ chown redis /var/log/redis
EOF
systemctl enable ramlogs
}
- exit 0
}
+exit 0
+
# License
#
# This script is free software; you can redistribute it and/or modify it