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:
authornachoparker <nacho@ownyourbits.com>2017-03-15 10:05:10 +0300
committernachoparker <nacho@ownyourbits.com>2017-03-15 10:05:10 +0300
commit71cfa60d22cf52b8d4789ac826368ede22dae6de (patch)
treee1bbb39bb1682fbb4c1c4f5802ef1367daa65117
parent6ed507a7f7348eec25439d44eea2f724c75f79b8 (diff)
batch build improvements
-rwxr-xr-xbatch.sh15
-rwxr-xr-xinstall-nextcloud.sh8
-rwxr-xr-xinstaller.sh8
-rwxr-xr-xlibrary.sh24
4 files changed, 29 insertions, 26 deletions
diff --git a/batch.sh b/batch.sh
index c442c759..576ee580 100755
--- a/batch.sh
+++ b/batch.sh
@@ -11,15 +11,16 @@
IP=$1 # First argument is the QEMU Raspbian IP address
-IMG=$2 # TODO
-IMG=NextCloudPi_03-13-17.img
+IMGFILE="NextCloudPi_$( date "+%m-%d-%y" ).img"
-NO_CONFIG=1 NO_HALT_STEP=1 ./install-nextcloud.sh $IP
-NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh fail2ban.sh $IP $( ls -1t *.img | head -1 )
-NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh no-ip.sh $IP $( ls -1t *.img | head -1 )
-NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh dnsmasq.sh $IP $( ls -1t *.img | head -1 )
-#TODO rename to FULL
+NO_CONFIG=1 NO_HALT_STEP=1 ./install-nextcloud.sh $IP $IMGFILE
+NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh fail2ban.sh $IP $( ls -1t *.img | head -1 )
+NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh no-ip.sh $IP $( ls -1t *.img | head -1 )
+NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh dnsmasq.sh $IP $( ls -1t *.img | head -1 )
+NO_CONFIG=1 NO_CFG_STEP=1 ./installer.sh letsencrypt.sh $IP $( ls -1t *.img | head -1 )
+
+cp -v "$( ls -1t *.img | head -1 )" $( basename "$IMGFILE" .img )_FULL.img
# License
#
diff --git a/install-nextcloud.sh b/install-nextcloud.sh
index 35b3a627..beccc022 100755
--- a/install-nextcloud.sh
+++ b/install-nextcloud.sh
@@ -13,11 +13,11 @@
# Set DOWNLOAD=0 if you have already downloaded an image. Rename it to nextcloudpi.img
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
IMG=raspbian_lite_latest
INSTALL_SCRIPT=nextcloud.sh
-IMGFILE="NextCloudPi_$( date "+%m-%d-%y" ).img"
source library.sh # initializes $IMGOUT
@@ -34,9 +34,9 @@ config $INSTALL_SCRIPT || exit 1
launch_install_qemu "$IMGFILE" $IP || exit 1
CONFDIR=/usr/local/etc/nextcloudpi-config.d/
-copy_to_image $( ls -1t $IMGFILE-stage* | head -1 ) $CONFDIR nc-limits.sh nc-datadir.sh
-copy_to_image $( ls -1t $IMGFILE-stage* | head -1 ) $CONFDIR/library library.sh
-copy_to_image $( ls -1t $IMGFILE-stage* | head -1 ) /usr/local/bin/ nextcloudpi-config
+copy_to_image "$IMGOUT" $CONFDIR nc-limits.sh nc-datadir.sh
+copy_to_image "$IMGOUT" $CONFDIR/library library.sh
+copy_to_image "$IMGOUT" /usr/local/bin/ nextcloudpi-config
pack_image $IMGFILE $IMGOUT
diff --git a/installer.sh b/installer.sh
index 0bfb3ae7..d498ea98 100755
--- a/installer.sh
+++ b/installer.sh
@@ -35,14 +35,14 @@ IP=$2 # Second argument is the QEMU Raspbian IP address
IMGFILE=$3 # Third argument is the image file to start from ( empty for online installation )
CONFDIR=/usr/local/etc/nextcloudpi-config.d/
-source library.sh # initializes $IMGOUT
+source library.sh # initializes $IMGNAME
config $INSTALL_SCRIPT || exit 1
if [[ "$IMGFILE" != "" ]]; then
- launch_install_qemu "$IMGFILE" $IP || exit 1
- copy_to_image $( ls -1t $IMGFILE-stage* | head -1 ) $CONFDIR $INSTALL_SCRIPT || exit 1
- pack_image "$IMGFILE" "$IMGOUT"
+ launch_install_qemu "$IMGFILE" $IP || exit 1 # initializes $IMGOUT
+ copy_to_image "$IMGOUT" $CONFDIR $INSTALL_SCRIPT || exit 1
+ pack_image "$IMGOUT" "$IMGNAME"
else
launch_installation_online $IP
fi
diff --git a/library.sh b/library.sh
index 84a5e615..dc2db9c1 100755
--- a/library.sh
+++ b/library.sh
@@ -6,10 +6,11 @@
# GPL licensed (see end of file) * Use at your own risk!
-IMGOUT=$( basename $IMGFILE .img )_$( basename $INSTALL_SCRIPT .sh ).img
+IMGNAME=$( basename $IMGFILE .img )_$( basename $INSTALL_SCRIPT .sh ).img
CFGOUT=config_$( basename $INSTALL_SCRIPT .sh ).txt
DBG=x
+# $IMGOUT will contain the name of the last step
function launch_install_qemu()
{
local IMG=$1
@@ -24,18 +25,18 @@ function launch_install_qemu()
local NUM_REBOOTS=$( grep -c reboot $INSTALL_SCRIPT )
while [[ $NUM_REBOOTS != -1 ]]; do
NUM=$(( NUM+1 ))
- local IMGFILE="$BASE-stage$NUM"
- cp -v $IMG $IMGFILE || return 1 # take a copy of the input image for processing ( append "-stage1" )
+ IMGOUT="$BASE-stage$NUM"
+ cp -v $IMG $IMGOUT || return 1 # take a copy of the input image for processing ( append "-stage1" )
- launch_qemu $IMGFILE &
+ launch_qemu $IMGOUT &
sleep 10
wait_SSH $IP
launch_installation_qemu $IP || return 1
wait
- IMG="$IMGFILE"
+ IMG="$IMGOUT"
NUM_REBOOTS=$(( NUM_REBOOTS-1 ))
done
- echo "$IMGFILE generated successfully"
+ echo "$IMGOUT generated successfully"
}
function launch_qemu()
@@ -217,6 +218,7 @@ function copy_to_image()
local SECTOR=$( fdisk -l $IMG | grep Linux | awk '{ print $2 }' )
local OFFSET=$(( SECTOR * 512 ))
+ [ -f "$IMG" ] || { echo "no image"; return 1; }
mkdir -p tmpmnt
sudo mount $IMG -o offset=$OFFSET tmpmnt || return 1
sudo cp $SRC tmpmnt/$DST || return 1
@@ -226,11 +228,11 @@ function copy_to_image()
function pack_image()
{
- local IMGFILE="$1"
- local IMGOUT="$2"
- local TARNAME=$( basename $IMGOUT .img ).tar.bz2
- cp -v $( ls -1t $IMGFILE-stage* | head -1 ) $IMGOUT
- tar -I pbzip2 -cvf $TARNAME $IMGOUT &>/dev/null && \
+ local IMGOUT="$1"
+ local IMGNAME="$2"
+ local TARNAME=$( basename $IMGNAME .img ).tar.bz2
+ cp -v "$IMGOUT" "$IMGNAME" || return 1
+ tar -I pbzip2 -cvf $TARNAME "$IMGNAME" &>/dev/null && \
echo -e "$TARNAME packed successfully"
}