mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-09 14:42:01 -03:30
build: fix rpi build
Signed-off-by: nachoparker <nacho@ownyourbits.com>
This commit is contained in:
parent
891dc86c05
commit
76fbf5038e
@ -15,7 +15,6 @@ install()
|
||||
apt-get install -y --no-install-recommends pv openssh-client
|
||||
wget https://raw.githubusercontent.com/nachoparker/btrfs-sync/master/btrfs-sync -O /usr/local/bin/btrfs-sync
|
||||
chmod +x /usr/local/bin/btrfs-sync
|
||||
if ! [[ -f /root/.ssh/id_rsa ]]; then ssh-keygen -N "" -f /root/.ssh/id_rsa; fi
|
||||
}
|
||||
|
||||
configure()
|
||||
@ -29,6 +28,7 @@ configure()
|
||||
|
||||
# checks
|
||||
[[ -d "$SNAPDIR" ]] || { echo "$SNAPDIR does not exist"; return 1; }
|
||||
if ! [[ -f /root/.ssh/id_rsa ]]; then ssh-keygen -N "" -f /root/.ssh/id_rsa; fi
|
||||
|
||||
[[ "$DESTINATION" =~ : ]] && {
|
||||
local NET="$( sed 's|:.*||' <<<"$DESTINATION" )"
|
||||
|
||||
@ -26,9 +26,6 @@ source etc/library.sh # sets RELEASE
|
||||
# need sudo access that does not expire during build
|
||||
chage -d -1 root
|
||||
|
||||
# indicate that this will be an Armbian image build
|
||||
touch /.ncp-image
|
||||
|
||||
# install NCP
|
||||
echo -e "\nInstalling NextCloudPi"
|
||||
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
#
|
||||
# Place here configuration options that differ from standard NCP build options
|
||||
#
|
||||
|
||||
#BRANCH=dev
|
||||
@ -1,5 +0,0 @@
|
||||
#
|
||||
# Place here configuration options that differ from standard NCP build options
|
||||
#
|
||||
|
||||
#BRANCH=dev
|
||||
@ -1,5 +0,0 @@
|
||||
#
|
||||
# Place here configuration options that differ from standard NCP build options
|
||||
#
|
||||
|
||||
#BRANCH=dev
|
||||
@ -1 +1,5 @@
|
||||
#
|
||||
# Place here configuration options that differ from standard NCP build options
|
||||
#
|
||||
|
||||
BRANCH=next
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
set -e
|
||||
source build/buildlib.sh
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP LXC ]\e[0m"
|
||||
|
||||
#CLEAN=0 # Pass this envvar to skip cleaning download cache
|
||||
IMG="NextCloudPi_LXC_$( date "+%m-%d-%y" ).img"
|
||||
IMG=tmp/"$IMG"
|
||||
@ -29,15 +31,13 @@ prepare_dirs # tmp cache output
|
||||
|
||||
## BUILD NCP
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP ]\e[0m"
|
||||
|
||||
# TODO sudo
|
||||
sudo lxc-destroy ncp -f
|
||||
sudo lxc-create -n ncp -t download -B btrfs -- --dist debian --release buster --arch amd64 # TODO vars for distro and stuff
|
||||
sudo cp lxc_config /var/lib/lxc/ncp/config
|
||||
sudo lxc-start -n ncp
|
||||
sudo lxc-attach -n ncp --clear-env -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" != "running" ] && [ "$(systemctl is-system-running 2>/dev/null)" != "degraded" ]; do :; done'
|
||||
sudo lxc-attach -n ncp --clear-env -- bash /build/install.sh
|
||||
sudo lxc-attach -n ncp --clear-env -- CODE_DIR="$(pwd)" bash /build/install.sh
|
||||
sudo lxc-attach -n ncp --clear-env -- bash -c 'source /build/etc/library.sh; run_app_unsafe /build/post-inst.sh'
|
||||
sudo lxc-attach -n ncp --clear-env -- poweroff
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
set -e
|
||||
source build/buildlib.sh
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP LXD ]\e[0m"
|
||||
|
||||
#CLEAN=0 # Pass this envvar to skip cleaning download cache
|
||||
IMG="NextCloudPi_LXD_$( date "+%m-%d-%y" ).img"
|
||||
IMG=tmp/"$IMG"
|
||||
@ -29,14 +31,13 @@ prepare_dirs # tmp cache output
|
||||
|
||||
## BUILD NCP
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP ]\e[0m"
|
||||
|
||||
lxc delete -f ncp 2>/dev/null || true
|
||||
systemd-run --user --scope -p "Delegate=yes" lxc launch images:debian/buster ncp
|
||||
lxc config device add ncp buildcode disk source="$(pwd)" path=/build
|
||||
lxc exec ncp -- bash -c 'while [ "$(systemctl is-system-running 2>/dev/null)" != "running" ] && [ "$(systemctl is-system-running 2>/dev/null)" != "degraded" ]; do :; done'
|
||||
lxc exec ncp -- bash -c 'CODE_DIR=/build bash /build/install.sh'
|
||||
lxc exec ncp -- bash -c 'source /build/etc/library.sh; run_app_unsafe /build/post-inst.sh'
|
||||
lxc stop ncp
|
||||
lxc config device remove ncp buildcode
|
||||
lxc publish ncp -f --alias ncp/"${version}"
|
||||
|
||||
|
||||
@ -8,17 +8,20 @@
|
||||
# Usage: ./build-SD-armbian.sh <board_code> [<board_name>]
|
||||
#
|
||||
|
||||
set -e
|
||||
source build/buildlib.sh
|
||||
|
||||
#CLEAN=0 # Pass this envvar to avoid cleaning download cache
|
||||
BOARD="$1"
|
||||
BNAME="${2:-$1}"
|
||||
NCPCFG=etc/ncp.cfg
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP ${BNAME} ]\e[0m"
|
||||
|
||||
IMG="NextCloudPi_${BNAME}_$( date "+%m-%d-%y" ).img"
|
||||
IMG=tmp/"$IMG"
|
||||
TAR=output/"$( basename "$IMG" .img ).tar.bz2"
|
||||
|
||||
set -e
|
||||
source build/buildlib.sh
|
||||
|
||||
test -f "$TAR" && { echo "$TAR already exists. Skipping... "; exit 0; }
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
set -e
|
||||
source build/buildlib.sh
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP Berryboot ]\e[0m"
|
||||
|
||||
SRC="$1"
|
||||
IMG="NextCloudPi_RPi_Berryboot_$( date "+%m-%d-%y" ).img"
|
||||
TAR=output/"$( basename "$IMG" .img ).tar.bz2"
|
||||
|
||||
@ -11,8 +11,10 @@
|
||||
set -e
|
||||
source build/buildlib.sh
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP Raspberry Pi ]\e[0m"
|
||||
|
||||
URL="https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2020-08-24/2020-08-20-raspios-buster-arm64-lite.zip"
|
||||
SIZE=3G # Raspbian image size
|
||||
SIZE=4G # Raspbian image size
|
||||
#CLEAN=0 # Pass this envvar to skip cleaning download cache
|
||||
IMG="NextCloudPi_RPi_$( date "+%m-%d-%y" ).img"
|
||||
TAR=output/"$( basename "$IMG" .img ).tar.bz2"
|
||||
@ -38,7 +40,6 @@ rm -f ncp-web/{wizard.cfg,ncp-web.cfg}
|
||||
|
||||
## BUILD NCP
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP ]\e[0m"
|
||||
prepare_chroot_raspbian "$IMG"
|
||||
|
||||
mkdir raspbian_root/tmp/ncp-build
|
||||
@ -48,9 +49,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||
sudo chroot raspbian_root /bin/bash <<'EOFCHROOT'
|
||||
set -e
|
||||
|
||||
# mark the image as an image build
|
||||
touch /.ncp-image
|
||||
|
||||
# allow oldstable
|
||||
apt-get update --allow-releaseinfo-change
|
||||
|
||||
@ -63,20 +61,9 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||
#$APTINSTALL rpi-update
|
||||
#echo -e "y\n" | PRUNE_MODULES=1 rpi-update
|
||||
|
||||
# install everything
|
||||
# install NCP
|
||||
cd /tmp/ncp-build || exit 1
|
||||
mkdir -p /usr/local/etc/ncp-config.d
|
||||
cp etc/ncp-config.d/nc-nextcloud.cfg /usr/local/etc/ncp-config.d/
|
||||
cp etc/ncp.cfg /usr/local/etc/
|
||||
cp etc/library.sh /usr/local/etc/
|
||||
cp -r etc/ncp-templates /usr/local/etc/
|
||||
source etc/library.sh
|
||||
install_app lamp.sh
|
||||
install_app bin/ncp/CONFIG/nc-nextcloud.sh
|
||||
run_app_unsafe bin/ncp/CONFIG/nc-nextcloud.sh
|
||||
install_app ncp.sh
|
||||
run_app_unsafe bin/ncp/CONFIG/nc-init.sh
|
||||
run_app_unsafe post-inst.sh
|
||||
CODE_DIR="$(pwd)" bash install.sh
|
||||
|
||||
# work around dhcpcd Raspbian bug
|
||||
# https://lb.raspberrypi.org/forums/viewtopic.php?t=230779
|
||||
@ -95,6 +82,8 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
||||
cfg="$(jq '.params[3].value = "raspberry"' <<<"$cfg")"
|
||||
echo "$cfg" > /usr/local/etc/ncp-config.d/SSH.cfg
|
||||
|
||||
$ cleanup
|
||||
source etc/library.sh && run_app_unsafe post-inst.sh
|
||||
rm -rf /tmp/ncp-build
|
||||
EOFCHROOT
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
set -e
|
||||
source build/buildlib.sh
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP VM ]\e[0m"
|
||||
|
||||
IP=${1:-192.168.0.145} # For QEMU automated testing (optional)
|
||||
SIZE=3G # Raspbian image size
|
||||
#CLEAN=0 # Pass this envvar to skip cleaning download cache
|
||||
@ -32,7 +34,6 @@ prepare_dirs # tmp cache output
|
||||
|
||||
## BUILD NCP
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP ]\e[0m"
|
||||
export DEB_RELEASE=$(jq -r .release < etc/ncp.cfg)
|
||||
cd build/
|
||||
vagrant destroy -f
|
||||
|
||||
@ -18,6 +18,8 @@ function build_arch()
|
||||
local arch_qemu="${3}"
|
||||
local ncp_tag="${4:-$arch}"
|
||||
|
||||
echo -e "\e[1m\n[ Build NCP Docker ${arch} ]\e[0m"
|
||||
|
||||
docker_build -f build/docker/debian-ncp/Dockerfile -t ownyourbits/debian-ncp-${ncp_tag}:latest --pull --build-arg release=${release} --build-arg arch=${arch} --build-arg arch_qemu=${arch_qemu}
|
||||
docker_build -f build/docker/lamp/Dockerfile -t ownyourbits/lamp-${ncp_tag}:latest --build-arg release=${release} --build-arg arch=${ncp_tag}
|
||||
docker_build -f build/docker/nextcloud/Dockerfile -t ownyourbits/nextcloud-${ncp_tag}:latest --build-arg release=${release} --build-arg arch=${ncp_tag}
|
||||
|
||||
@ -222,7 +222,7 @@ EOF
|
||||
umount_raspbian
|
||||
}
|
||||
|
||||
function prepare_sshd()
|
||||
function prepare_sshd_raspbian()
|
||||
{
|
||||
local IMG="$1"
|
||||
mount_raspbian_boot "$IMG" || return 1
|
||||
|
||||
@ -66,9 +66,11 @@ rm /usr/local/etc/ncp-config.d/nc-nextcloud.cfg # armbian overlay is ro
|
||||
systemctl restart mysqld # TODO this shouldn't be necessary, but somehow it's needed in Debian 9.6. Fixme
|
||||
install_app ncp.sh
|
||||
run_app_unsafe bin/ncp/CONFIG/nc-init.sh
|
||||
bash /usr/local/bin/ncp-provisioning.sh
|
||||
rm /.ncp-image
|
||||
|
||||
# skip on Armbian / Vagrant / LXD ...
|
||||
[[ "${CODE_DIR}" != "" ]] || bash /usr/local/bin/ncp-provisioning.sh
|
||||
|
||||
cd -
|
||||
rm -rf "${TMPDIR}"
|
||||
|
||||
|
||||
16
post-inst.sh
16
post-inst.sh
@ -10,12 +10,15 @@
|
||||
|
||||
configure()
|
||||
{
|
||||
# stop mysqld and redis
|
||||
mysqladmin -u root shutdown || true
|
||||
kill $( cat /run/redis/redis-server.pid ) || true
|
||||
[[ -f /run/crond.pid ]] && kill $( cat /run/crond.pid )
|
||||
pkill -f php-fpm || true
|
||||
pkill -f notify_push || true
|
||||
(
|
||||
set +e
|
||||
|
||||
# stop services
|
||||
pkill -x redis-server
|
||||
pgrep -x mysqld &>/dev/null && mysqladmin -u root shutdown
|
||||
[[ -f /run/crond.pid ]] && kill "$(cat /run/crond.pid)"
|
||||
pkill -f php-fpm
|
||||
pkill -f notify_push
|
||||
|
||||
# cleanup all NCP extras
|
||||
source /usr/local/etc/library.sh
|
||||
@ -30,6 +33,7 @@ configure()
|
||||
|
||||
# clean build flags
|
||||
rm -f /.ncp-image
|
||||
)
|
||||
}
|
||||
|
||||
# License
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user