mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-10 15:12:01 -03:30
added armbian support
This commit is contained in:
parent
6fe08e6858
commit
6883aa2da7
58
armbian.sh
Normal file
58
armbian.sh
Normal file
@ -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
|
||||
@ -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; \
|
||||
|
||||
@ -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; \
|
||||
|
||||
@ -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,10 +124,10 @@ 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', '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
|
||||
|
||||
|
||||
@ -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; }
|
||||
|
||||
12
install.sh
12
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
|
||||
|
||||
9
lamp.sh
9
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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
##########################################
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user