Skip to content

Commit

Permalink
build: fully local builds
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Sep 22, 2018
1 parent 7a8c0e4 commit dabc17f
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ torrent/
tmp/
cache/
output/
raspbian_root/
raspbian_boot/
qemu-raspbian-network/
armbian/
*.img
Expand Down
13 changes: 12 additions & 1 deletion armbian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
3 changes: 2 additions & 1 deletion bin/ncp-update
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion build-SD-armbian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions build-SD-rpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
21 changes: 13 additions & 8 deletions docker-armhf/nextcloudpi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \

Expand All @@ -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; \
Expand Down
21 changes: 13 additions & 8 deletions docker/nextcloudpi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \

Expand All @@ -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; \
Expand Down
1 change: 0 additions & 1 deletion etc/ncp-config.d/nc-prettyURL.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &
Expand Down
8 changes: 2 additions & 6 deletions ncp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dabc17f

Please sign in to comment.