Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbatch.sh8
-rw-r--r--docker/docker-env.sh46
-rwxr-xr-xetc/library.sh18
-rw-r--r--[-rwxr-xr-x]etc/nextcloudpi-config.d/nc-automount.sh0
-rw-r--r--[-rwxr-xr-x]etc/nextcloudpi-config.d/nc-nextcloud.sh0
-rwxr-xr-xinstaller.sh2
-rwxr-xr-x[-rw-r--r--]prepare-build-env-docker.sh (renamed from prepare-img.sh)34
-rw-r--r--prepare.sh2
8 files changed, 88 insertions, 22 deletions
diff --git a/batch.sh b/batch.sh
index 266a6a49..7aaa1a78 100755
--- a/batch.sh
+++ b/batch.sh
@@ -17,16 +17,18 @@ NC_CONFIG=etc/nc-init.sh
IMGBASE="NextCloudPi_$( date "+%m-%d-%y" )_base.img"
-export NO_CONFIG=1 # skip interactive configuration
+export NO_CONFIG=1 # skip interactive configuration
-NO_HALT_STEP=1 ./prepare-img.sh $IP $IMGBASE || exit 1
+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 $NC_CONFIG $IP $( ls -1t *.img | head -1 ) || exit 1
./installer.sh nextcloudpi.sh $IP $( ls -1t *.img | head -1 ) || exit 1
IMGFILE=$( ls -1t *.img | head -1 )
-IMGOUT=$( basename "$IMGFILE" _base_lamp_nc-nextcloud_nc-init_nextcloudpi.img ).img
+IMGOUT=$( basename "$IMGFILE" _base_prepare_lamp_nc-nextcloud_nc-init_nextcloudpi.img ).img
pack_image "$IMGFILE" "$IMGOUT"
md5sum $( ls -1t *.img | head -1 )
diff --git a/docker/docker-env.sh b/docker/docker-env.sh
new file mode 100644
index 00000000..9320375a
--- /dev/null
+++ b/docker/docker-env.sh
@@ -0,0 +1,46 @@
+#!/bin/bish
+
+# Install docker ARM on Raspbian
+# Tested with 2017-03-02-raspbian-jessie-lite.img
+#
+# 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 docker-env.sh <DHCP QEMU image IP> <image>
+#
+
+
+install()
+{
+ curl -sSL get.docker.com | sh
+ usermod -aG docker pi
+}
+
+configure(){ :; }
+
+cleanup()
+{
+ apt-get autoremove
+ apt-get clean
+ rm /var/lib/apt/lists/* -r
+ rm -f /home/pi/.bash_history
+
+ systemctl disable ssh
+}
+
+# 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
diff --git a/etc/library.sh b/etc/library.sh
index 5cfd1cba..fc6f1141 100755
--- a/etc/library.sh
+++ b/etc/library.sh
@@ -257,6 +257,24 @@ function copy_to_image()
rmdir tmpmnt &>/dev/null
}
+function download_resize_raspbian_img()
+{
+ local SIZE=$1
+ local IMGFILE=$2
+ local IMG=raspbian_lite_latest
+
+ test -f $IMGFILE && \
+ echo -e "INFO: $IMGFILE already exists. Skipping download ..." && return 0
+
+ test -f $IMG.zip || \
+ wget https://downloads.raspberrypi.org/$IMG -O $IMG.zip || return 1
+
+ unzip -o $IMG.zip && \
+ mv *-raspbian-*.img $IMGFILE && \
+ qemu-img resize -f raw $IMGFILE +$SIZE && \
+ return 0
+}
+
function pack_image()
{
local IMGOUT="$1"
diff --git a/etc/nextcloudpi-config.d/nc-automount.sh b/etc/nextcloudpi-config.d/nc-automount.sh
index 3e95db67..3e95db67 100755..100644
--- a/etc/nextcloudpi-config.d/nc-automount.sh
+++ b/etc/nextcloudpi-config.d/nc-automount.sh
diff --git a/etc/nextcloudpi-config.d/nc-nextcloud.sh b/etc/nextcloudpi-config.d/nc-nextcloud.sh
index 20d84b15..20d84b15 100755..100644
--- a/etc/nextcloudpi-config.d/nc-nextcloud.sh
+++ b/etc/nextcloudpi-config.d/nc-nextcloud.sh
diff --git a/installer.sh b/installer.sh
index 06a32cde..d6f2c06c 100755
--- a/installer.sh
+++ b/installer.sh
@@ -38,7 +38,7 @@ IMGFILE=$3 # Third argument is the image file to start from ( empty
source etc/library.sh # initializes $IMGNAME
-config $INSTALL_SCRIPT || exit 1
+config $INSTALL_SCRIPT || exit 1 # Initializes $INSTALLATION_CODE
if [[ "$IMGFILE" != "" ]]; then
launch_install_qemu "$IMGFILE" $IP || { sudo killall qemu-system-arm; exit 1; } # initializes $IMGOUT
diff --git a/prepare-img.sh b/prepare-build-env-docker.sh
index c61f869e..a63e1ab5 100644..100755
--- a/prepare-img.sh
+++ b/prepare-build-env-docker.sh
@@ -1,41 +1,42 @@
#!/bin/bash
-# Nextcloud installation on QEMU emulated Raspbian image
+# Create a Raspbian image with docker
# Tested with 2017-03-02-raspbian-jessie-lite.img
#
# 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:
-# ./prepare-img.sh <IP> # Use the IP of your running QEMU Raspbian image
+# ./prepare-build-env-docker.sh <IP> # Use the IP of your running QEMU Raspbian image
#
# Notes:
# Set DOWNLOAD=0 if you have already downloaded an image.
# Set EXTRACT=0 if you have already extracted the image.
#
-# More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/
+# More at https://ownyourbits.com
#
IP=$1 # First argument is the QEMU Raspbian IP address
-IMGFILE=$2 # Second argument is the name for the output image
-DOWNLOAD=1 # Download the latest image
-EXTRACT=1 # Extract the image from zip, so start from 0
+DOWNLOAD=0 # Download the latest image
+EXTRACT=0 # Extract the image from zip, so start from 0
IMG=raspbian_lite_latest
-INSTALL_SCRIPT=prepare.sh
source etc/library.sh # initializes $IMGNAME
-[[ "$DOWNLOAD" == "1" ]] && { wget https://downloads.raspberrypi.org/$IMG -O $IMG.zip || exit 1; }
-[[ "$DOWNLOAD" == "1" ]] || [[ "$EXTRACT" == "1" ]] && {
- unzip $IMG.zip && \
- mv *-raspbian-*.img $IMGFILE && \
- qemu-img resize $IMGFILE +1G || exit 1
-}
+IMGBASE="raspbian_docker_base.img"
-config $INSTALL_SCRIPT || exit 1 # Initializes $INSTALLATION_CODE
-launch_install_qemu "$IMGFILE" $IP || exit 1 # initializes $IMGOUT
+export NO_CONFIG=1 # skip interactive configuration
+
+download_resize_raspbian_img 3G $IMGBASE || exit 1
+
+NO_HALT_STEP=1 ./installer.sh prepare.sh $IP $IMGBASE || exit 1
+ ./installer.sh docker/docker-env.sh $IP $( ls -1t *.img | head -1 ) || exit 1
+
+IMGFILE=$( ls -1t *.img | head -1 )
+IMGOUT="raspbian_docker.img"
+
+pack_image "$IMGFILE" "$IMGOUT"
-pack_image $IMGOUT $IMGFILE
# License
#
@@ -53,4 +54,3 @@ pack_image $IMGOUT $IMGFILE
# along with this script; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
-
diff --git a/prepare.sh b/prepare.sh
index 632fc813..58c4d5a5 100644
--- a/prepare.sh
+++ b/prepare.sh
@@ -1,6 +1,6 @@
#!/bin/bish
-# Prepare a Raspbian image (download, resize and update)
+# Prepare a Raspbian image (resize and update)
# Tested with 2017-03-02-raspbian-jessie-lite.img
#
# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>