diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-11-26 18:56:23 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-11-26 18:56:23 +0300 |
commit | 98c664938f0133fc351bbfe435d85c4a4e896514 (patch) | |
tree | 618622a59eac7f552854c4aaa0206833825f8fdc | |
parent | 39064cc5fc718c1419acf4cad17d32d8114bcbe2 (diff) |
build: autoupload ftp
-rwxr-xr-x | build-SD.sh | 36 | ||||
-rw-r--r-- | buildlib.sh | 46 |
2 files changed, 68 insertions, 14 deletions
diff --git a/build-SD.sh b/build-SD.sh index d9960026..6eaa2e72 100755 --- a/build-SD.sh +++ b/build-SD.sh @@ -24,12 +24,12 @@ export NO_CONFIG=1 # skip interactive configuration download_resize_raspbian_img 1G "$IMGBASE" || exit 1 -NO_HALT_STEP=1 ./installer.sh prepare.sh "$IP" "$IMGBASE" || exit 1 - ./installer.sh lamp.sh "$IP" "$( ls -1t *.img | head -1 )" || exit 1 - ./installer.sh $NC_INSTALL "$IP" "$( ls -1t *.img | head -1 )" || exit 1 - ./installer.sh nextcloudpi.sh "$IP" "$( ls -1t *.img | head -1 )" || exit 1 - ./installer.sh $NC_CONFIG "$IP" "$( ls -1t *.img | head -1 )" || exit 1 - ./installer.sh raspbian-cleanup "$IP" "$( ls -1t *.img | head -1 )" || exit 1 +NO_HALT_STEP=1 ./installer.sh prepare.sh "$IP" "$IMGBASE" || exit 1 + ./installer.sh lamp.sh "$IP" "$( ls -1t *.img | head -1 )" || exit 1 + ./installer.sh $NC_INSTALL "$IP" "$( ls -1t *.img | head -1 )" || exit 1 + ./installer.sh nextcloudpi.sh "$IP" "$( ls -1t *.img | head -1 )" || exit 1 + ./installer.sh $NC_CONFIG "$IP" "$( ls -1t *.img | head -1 )" || exit 1 + ./installer.sh raspbian-cleanup.sh "$IP" "$( ls -1t *.img | head -1 )" || exit 1 # ./installer.sh build-devel.sh "$IP" "$( ls -1t *.img | head -1 )" || exit 1 IMGFILE=$( ls -1t *.img | head -1 ) @@ -37,25 +37,33 @@ IMGNAME=$( basename "$IMGFILE" _base_prepare_lamp_nc-nextcloud_nextcloudpi_nc-in [[ "$IMGNAME" != "" ]] || exit 1 +## TESTING + +launch_qemu "$IMGNAME.img" & +sleep 10 +wait_SSH "$IP" +sleep 180 # Wait for the services to start. Improve this ( wait HTTP && trusted domains ) +tests/tests.py "$IP" || exit 1 + +ssh_pi "$IP" sudo halt + ## PACKING pack_image "$IMGFILE" "$IMGNAME.img" create_torrent "${IMGNAME}.tar.bz2" -mkdir -p partial && mv NextCloudPi*.bz2 partial +## UPLOADING + +upload_ftp "$IMGNAME" ## GENERATE CHANGELOG + generate_changelog -## TESTING -launch_qemu "$IMGNAME.img" & -sleep 10 -wait_SSH "$IP" -sleep 180 # Wait for the services to start. Improve this ( wait HTTP && trusted domains ) -tests/tests.py "$IP" +## CLEANUP -ssh_pi "$IP" sudo halt +mkdir -p partial && mv NextCloudPi*.bz2 partial rm -f *.img diff --git a/buildlib.sh b/buildlib.sh index ec494d46..13d6068e 100644 --- a/buildlib.sh +++ b/buildlib.sh @@ -237,3 +237,49 @@ function prepare_sshd() sudo umount tmpmnt rmdir tmpmnt } + +function upload_ftp() +{ + local IMGNAME="$1" + [[ -f "$IMGNAME" ]] || { echo "No image file found, abort"; return 1; } + [[ "$FTPPASS" == "" ]] && { echo "No FTPPASS variable found, abort"; return 1; } + + cd torrent + + ftp -np ftp.ownyourbits.com <<EOF +user root@ownyourbits.com $FTPPASS +mkdir $IMGNAME +cd $IMGNAME +binary +put $IMGNAME.torrent +bye +EOF + cd - + cd $IMGNAME + + ftp -np ftp.ownyourbits.com <<EOF +user root@ownyourbits.com $FTPPASS +cd $IMGNAME +binary +put $IMGNAME.tar.bz2 +bye +EOF + cd - +} + +# 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 |