build: fix SD card generation and provisioning

This commit is contained in:
nachoparker 2018-03-18 12:07:00 +01:00
parent 423ea0ed00
commit 1e12154fc6
6 changed files with 12 additions and 67 deletions

View File

@ -56,6 +56,9 @@ Main() {
cleanup_script $script
done
# enable randomize passwords
systemctl enable nc-provisioning
;;
esac
} # Main

View File

@ -38,7 +38,6 @@ NO_HALT_STEP=1 ./installer.sh prepare.sh "$IP" "$IMGBASE"
./installer.sh nextcloudpi.sh "$IP" "$( ls -1t *.img | head -1 )"
./installer.sh $NC_CONFIG "$IP" "$( ls -1t *.img | head -1 )"
./installer.sh raspbian-cleanup.sh "$IP" "$( ls -1t *.img | head -1 )"
# ./installer.sh build-devel.sh "$IP" "$( ls -1t *.img | head -1 )"
## PACKING
@ -62,7 +61,7 @@ ssh_pi "$IP" sudo halt
## UPLOADING
create_torrent "${IMGNAME}.tar.bz2"
upload_ftp "$IMGNAME"
upload_ftp "$IMGNAME" || true
## CLEANUP

View File

@ -1,61 +0,0 @@
#!/bin/bash
# Perform a software update in NextCloudPi
#
# 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!
#
# Usage:
#
# ./installer.sh build-devel.sh <IP> (<img>)
#
# See installer.sh instructions for details
#
# More at https://ownyourbits.com/
#
# this is a replica of ncp-update, but from devel branch
install()
{
# wait for other apt processes
pgrep apt &>/dev/null && echo "waiting for apt processes to finish..." && \
while :; do
pgrep apt &>/dev/null || break
sleep 1
done
# disable unattended upgrades
rm -f /etc/apt/apt.conf.d/20nextcloudpi-upgrades
ncp-update devel
}
configure() { :; }
cleanup()
{
apt-get autoremove -y
apt-get clean
rm -rf /var/lib/apt/lists/*
systemctl disable ssh
rm -f /etc/udev/rules.d/90-qemu.rules
sudo -u www-data php /var/www/nextcloud/occ config:system:delete trusted_domains 1
}
# 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

View File

@ -23,7 +23,7 @@ function launch_install_qemu()
local NUM=$( sed 's=.*-stage\([[:digit:]]\)=\1=' <<< "$IMG" )
[[ "$BASE" == "$IMG" ]] && NUM=0
local NUM_REBOOTS=$( grep -c reboot "$INSTALL_SCRIPT" )
local NUM_REBOOTS=$( grep -c "nohup reboot" "$INSTALL_SCRIPT" )
while [[ $NUM_REBOOTS != -1 ]]; do
NUM=$(( NUM+1 ))
IMGOUT="$BASE-stage$NUM"

View File

@ -40,6 +40,9 @@ You can use nc-backup "
install()
{
# During build, this step is run before nextcloudpi.sh. Avoid executing twice
[[ -f /usr/lib/systemd/system/nc-provisioning.service ]] && return 0
# Optional packets for Nextcloud and Apps
apt-get update
$APTINSTALL lbzip2 iputils-ping
@ -91,7 +94,7 @@ install()
[Unit]
Description=Randomize passwords on first boot
Requires=network.target
After=mysql.service
After=mysql.service redis.service
[Service]
ExecStart=/bin/bash /usr/local/bin/ncp-provisioning.sh
@ -99,8 +102,6 @@ ExecStart=/bin/bash /usr/local/bin/ncp-provisioning.sh
[Install]
WantedBy=multi-user.target
EOF
[[ "$DOCKERBUILD" != 1 ]] && systemctl enable nc-provisioning
return 0
}

View File

@ -71,6 +71,9 @@ EOF
# disable SSH
systemctl disable ssh
# enable randomize passwords
systemctl enable nc-provisioning
}
# License