Skip to content

Commit 30ca93c

Browse files
committed
build: add LXC/LXD support
Signed-off-by: nachoparker <nacho@ownyourbits.com>
1 parent c037c11 commit 30ca93c

41 files changed

Lines changed: 355 additions & 162 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
.*.swp
2-
qemu-raspbian-network/
3-
archive/
4-
output/
5-
cache/
6-
torrent/
7-
armbian/
8-
raspbian_root
9-
raspbian_boot
10-
ncp-web/wizard.cfg
11-
ncp-web/ncp-web.cfg
12-
docker-armhf/qemu-arm-static
13-
.vagrant/
2+
/qemu-raspbian-network/
3+
/archive/
4+
/output/
5+
/cache/
6+
/torrent/
7+
/armbian/
8+
/raspbian_root
9+
/raspbian_boot
10+
/ncp-web/wizard.cfg
11+
/ncp-web/ncp-web.cfg
12+
/docker-armhf/qemu-arm-static
13+
/.vagrant/

bin/ncp-provisioning.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
# this script runs at startup to provide an unique random passwords for each instance
44

5+
source /usr/local/etc/library.sh
6+
57
## redis provisioning
68

79
CFG=/var/www/nextcloud/config/config.php
@@ -14,7 +16,7 @@ REDISPASS="$( grep "^requirepass" /etc/redis/redis.conf | cut -f2 -d' ' )"
1416
echo Provisioning Redis password
1517
sed -i -E "s|^requirepass .*|requirepass $REDISPASS|" /etc/redis/redis.conf
1618
chown redis:redis /etc/redis/redis.conf
17-
[[ "$DOCKERBUILD" != 1 ]] && systemctl restart redis
19+
is_docker || systemctl restart redis
1820
}
1921

2022
### If there exists already a configuration adjust the password

bin/ncp/CONFIG/nc-nextcloud.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ install()
1919
# During build, this step is run before ncp.sh. Avoid executing twice
2020
[[ -f /usr/lib/systemd/system/nc-provisioning.service ]] && return 0
2121

22-
source /usr/local/etc/library.sh # sets PHPVER RELEASE
23-
2422
# Optional packets for Nextcloud and Apps
2523
apt-get update
26-
$APTINSTALL lbzip2 iputils-ping jq
24+
$APTINSTALL lbzip2 iputils-ping jq wget
2725
$APTINSTALL -t $RELEASE php-smbclient exfat-fuse exfat-utils # for external storage
2826
$APTINSTALL -t $RELEASE php${PHPVER}-exif # for gallery
2927
$APTINSTALL -t $RELEASE php${PHPVER}-gmp # for bookmarks
@@ -56,6 +54,16 @@ install()
5654
echo "maxmemory $REDIS_MEM" >> $REDIS_CONF
5755
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
5856

57+
if is_lxc; then
58+
# Otherwise it fails to start in Buster LXC container
59+
mkdir -p /etc/systemd/system/redis-server.service.d
60+
cat > /etc/systemd/system/redis-server.service.d/lxc_fix.conf <<'EOF'
61+
[Service]
62+
ReadOnlyDirectories=
63+
EOF
64+
systemctl daemon-reload
65+
fi
66+
5967
chown redis: "$REDIS_CONF"
6068
usermod -a -G redis www-data
6169

bin/ncp/NETWORKING/letsencrypt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ install()
3535
rm -f /etc/cron.d/certbot
3636
mkdir -p /etc/letsencrypt/live
3737

38-
[[ "$DOCKERBUILD" == 1 ]] && {
38+
is_docker && {
3939
# execute before lamp stack
4040
cat > /etc/services-available.d/009letsencrypt <<EOF
4141
#!/bin/bash
@@ -125,7 +125,7 @@ EOF
125125
rm -rf $ncdir/.well-known
126126

127127
# Update configuration
128-
[[ "$DOCKERBUILD" == 1 ]] && update-rc.d letsencrypt enable
128+
is_docker && update-rc.d letsencrypt enable
129129

130130
return 0
131131
}

bin/ncp/SYSTEM/nc-swapfile.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ configure()
4747

4848
install()
4949
{
50-
apt-get update
51-
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends dphys-swapfile
50+
apt_install dphys-swapfile
5251
}
5352

5453

Vagrantfile renamed to build/Vagrantfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Vagrant.configure("2") do |config|
2626
BRANCH=master
2727
#BRANCH=devel # uncomment to install devel
2828
apt-get update
29-
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git
29+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates
3030
3131
# install
3232
git clone -b "$BRANCH" https://github.com/nextcloud/nextcloudpi.git /tmp/nextcloudpi

armbian.sh renamed to build/armbian/armbian.sh

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,16 @@ touch /.ncp-image
3232
# install NCP
3333
echo -e "\nInstalling NextCloudPi"
3434

35-
mkdir -p /usr/local/etc/ncp-config.d/
36-
cp etc/ncp-config.d/nc-nextcloud.cfg /usr/local/etc/ncp-config.d/
37-
cp etc/library.sh /usr/local/etc/
38-
cp etc/ncp.cfg /usr/local/etc/
39-
4035
hostname -F /etc/hostname # fix 'sudo resolve host' errors
41-
install_app lamp.sh
42-
install_app bin/ncp/CONFIG/nc-nextcloud.sh
43-
run_app_unsafe bin/ncp/CONFIG/nc-nextcloud.sh
44-
rm /usr/local/etc/ncp-config.d/nc-nextcloud.cfg # armbian overlay is ro
45-
install_app ncp.sh
46-
run_app_unsafe bin/ncp/CONFIG/nc-init.sh
47-
run_app_unsafe post-inst.sh
4836

49-
cd -
37+
CODE_DIR="$(pwd)" bash install.sh
38+
run_app_unsafe post-inst.sh
5039

5140
# disable SSH by default, it can be enabled through ncp-web
5241
systemctl disable ssh
5342

43+
cd -
44+
5445

5546
# License
5647
#

0 commit comments

Comments
 (0)