build: fully local builds

This commit is contained in:
nacho 2018-09-21 00:15:50 -06:00
parent 7a8c0e40f5
commit dabc17fb07
10 changed files with 53 additions and 33 deletions

View File

@ -2,6 +2,8 @@ torrent/
tmp/
cache/
output/
raspbian_root/
raspbian_boot/
qemu-raspbian-network/
armbian/
*.img

View File

@ -25,7 +25,18 @@ chage -d -1 root
touch /.ncp-image
# install NCP
curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash
cd /tmp/overlay
echo -e "\nInstalling NextCloudPi"
source etc/library.sh
install_script lamp.sh
install_script etc/ncp-config.d/nc-nextcloud.sh
activate_script etc/ncp-config.d/nc-nextcloud.sh
install_script ncp.sh
activate_script etc/ncp-config.d/nc-init.sh
install_script post-inst.sh
cd -
# force change root password at first login (again)
chage -d 0 root

View File

@ -39,14 +39,14 @@ make nextcloudpi-x86 && {
}
# Docker armhf
cp /usr/bin/qemu-arm-static docker-armhf
cp -n /usr/bin/qemu-arm-static docker-armhf && \
make nextcloudpi-armhf && {
docker push ownyourbits/nextcloudpi-armhf
docker push ownyourbits/nextcloud-armhf
docker push ownyourbits/lamp-armhf
docker push ownyourbits/debian-ncp-armhf
}
rm docker-armhf/qemu-arm-static
rm -f docker-armhf/qemu-arm-static
# License
#

View File

@ -16,11 +16,12 @@
echo "No internet connectivity"
exit 1
}
cd "$TMPDIR"
[[ -f /.ncp-image ]] || cd "$TMPDIR" # update locally during build
echo -e "Performing updates"
./update.sh && {
cd "$TMPDIR"
VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" )
grep -qP "v\d+\.\d+\.\d+" <<< "$VER" && { # check format
echo "$VER" > /usr/local/etc/ncp-version

View File

@ -25,8 +25,9 @@ prepare_dirs # tmp cache output
( cd armbian && git pull --ff-only --tags )
# add NCP modifications
mkdir -p armbian/userpatches
mkdir -p armbian/userpatches armbian/userpatches/overlay
cp armbian.sh armbian/userpatches/customize-image.sh
rsync -Aax --delete --exclude-from .gitignore . armbian/userpatches/overlay/
# GENERATE IMAGE

View File

@ -33,7 +33,7 @@ echo -e "\e[1m\n[ Build NCP ]\e[0m"
prepare_chroot_raspbian "$IMG"
mkdir raspbian_root/tmp/ncp-build
cp etc/library.sh lamp.sh etc/ncp-config.d/{nc-nextcloud.sh,nc-init.sh} ncp.sh post-inst.sh raspbian_root/tmp/ncp-build
cp -r *.sh etc bin ncp-web raspbian_root/tmp/ncp-build
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
sudo chroot raspbian_root /bin/bash <<'EOFCHROOT'
@ -52,12 +52,12 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
# install everything
cd /tmp/ncp-build || exit 1
source library.sh
source etc/library.sh
install_script lamp.sh
install_script nc-nextcloud.sh
activate_script nc-nextcloud.sh
install_script etc/ncp-config.d/nc-nextcloud.sh
activate_script etc/ncp-config.d/nc-nextcloud.sh
install_script ncp.sh
activate_script nc-init.sh
activate_script etc/ncp-config.d/nc-init.sh
install_script post-inst.sh
# harden SSH further for Raspbian

View File

@ -6,7 +6,12 @@ SHELL ["/bin/bash", "-c"]
ENV DOCKERBUILD 1
COPY ncp.sh /usr/local/etc/
RUN mkdir -p /tmp/ncp-build
COPY bin/* /tmp/ncp-build/bin/
COPY etc /tmp/ncp-build/etc/
COPY ncp.sh update.sh /tmp/ncp-build/
COPY ncp-web /tmp/ncp-build/ncp-web/
COPY docker-common /tmp/ncp-build/docker-common/
RUN \
@ -22,25 +27,25 @@ apt-get install --no-install-recommends -y wget ca-certificates; \
# install nextcloudpi
source /usr/local/etc/library.sh; \
set +x; \
cd /usr/local/etc/; \
cd /tmp/ncp-build/; \
install_script ncp.sh; \
# fix default paths
sed -i 's|/media/USBdrive|/data/backups|' ncp-config.d/nc-backup.sh; \
sed -i 's|/media/USBdrive|/data/backups|' /usr/local/etc/ncp-config.d/nc-backup.sh; \
# specific cleanup
rm /usr/local/etc/ncp.sh; \
rm -r /tmp/ncp-build; \
rm /.ncp-image; \
# should be cleaned up in no-ip.sh, but breaks udiskie.
# safe to do it here since no automount in docker
apt-get purge -y make gcc libc-dev; \
# cleanup all NCP extras
source /usr/local/etc/library.sh; \
cd /usr/local/etc/ncp-config.d/; \
for script in *.sh; do cleanup_script $script; done; \
# should be cleaned up in no-ip.sh, but breaks udiskie.
# safe to do it here since no automount in docker
apt-get purge -y make gcc libc-dev; \
# package clean up
apt-get autoremove -y; \
apt-get clean; \

View File

@ -6,7 +6,12 @@ SHELL ["/bin/bash", "-c"]
ENV DOCKERBUILD 1
COPY ncp.sh /usr/local/etc/
RUN mkdir -p /tmp/ncp-build
COPY bin/* /tmp/ncp-build/bin/
COPY etc /tmp/ncp-build/etc/
COPY ncp.sh update.sh /tmp/ncp-build/
COPY ncp-web /tmp/ncp-build/ncp-web/
COPY docker-common /tmp/ncp-build/docker-common/
RUN \
@ -22,25 +27,25 @@ apt-get install --no-install-recommends -y wget ca-certificates; \
# install nextcloudpi
source /usr/local/etc/library.sh; \
set +x; \
cd /usr/local/etc/; \
cd /tmp/ncp-build/; \
install_script ncp.sh; \
# fix default paths
sed -i 's|/media/USBdrive|/data/backups|' ncp-config.d/nc-backup.sh; \
sed -i 's|/media/USBdrive|/data/backups|' /usr/local/etc/ncp-config.d/nc-backup.sh; \
# specific cleanup
rm /usr/local/etc/ncp.sh; \
rm -r /tmp/ncp-build; \
rm /.ncp-image; \
# should be cleaned up in no-ip.sh, but breaks udiskie.
# safe to do it here since no automount in docker
apt-get purge -y make gcc libc-dev; \
# cleanup all NCP extras
source /usr/local/etc/library.sh; \
cd /usr/local/etc/ncp-config.d/; \
for script in *.sh; do cleanup_script $script; done; \
# should be cleaned up in no-ip.sh, but breaks udiskie.
# safe to do it here since no automount in docker
apt-get purge -y make gcc libc-dev; \
# package clean up
apt-get autoremove -y; \
apt-get clean; \

View File

@ -25,7 +25,6 @@ configure()
} || {
sudo -u www-data php "$OCC" config:system:set htaccess.RewriteBase --value="/"
sudo -u www-data php "$OCC" maintenance:update:htaccess
a2enmod env
echo "Your cloud now has a pretty domain name."
}
bash -c "sleep 2 && service apache2 reload" &>/dev/null &

8
ncp.sh
View File

@ -21,7 +21,7 @@ install()
{
# NCP-CONFIG
apt-get update
$APTINSTALL dialog whiptail
$APTINSTALL git dialog whiptail
mkdir -p $CONFDIR
# include option in raspi-config (only Raspbian)
@ -182,11 +182,7 @@ EOF
chmod g+w /var/run/.ncp-latest-version
# update to latest version from github as part of the build process
$APTINSTALL git
wget https://raw.githubusercontent.com/nextcloud/nextcloudpi/$BRANCH/bin/ncp-update -O /usr/local/bin/ncp-update
chmod a+x /usr/local/bin/ncp-update
/usr/local/bin/ncp-update $BRANCH
bin/ncp-update $BRANCH
# ONLY FOR IMAGE BUILDS
if [[ -f /.ncp-image ]]; then