Skip to content

Commit

Permalink
ncp updates and motd. structure directories
Browse files Browse the repository at this point in the history
  • Loading branch information
nacho committed Mar 31, 2017
1 parent 20e877a commit 5892c60
Show file tree
Hide file tree
Showing 19 changed files with 260 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.*.swp
*.img
*.bz2
2 changes: 1 addition & 1 deletion batch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Usage:
#

source library.sh # initializes $IMGNAME
source etc/library.sh # initializes $IMGNAME

IP=$1 # First argument is the QEMU Raspbian IP address

Expand Down
11 changes: 2 additions & 9 deletions nextcloudpi-config → bin/nextcloudpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

CONFDIR=/usr/local/etc/nextcloudpi-config.d/

source $CONFDIR/library
source /usr/local/etc/library.sh

function nextcloud-config()
{
Expand All @@ -34,14 +34,7 @@ function nextcloud-config()

[[ $? -ne $DIALOG_OK ]] || [[ "$script" == "" ]] && return 0

(
cd $CONFDIR
config $script.sh || return 1 # writes "$INSTALLATION_CODE"
echo -e "$INSTALLATION_CODE" > $script.sh # save configuration
source ./$script.sh # load configuration
set +x
configure
)
configure_script $script.sh
}

if [ $(id -u) -ne 0 ]; then
Expand Down
29 changes: 28 additions & 1 deletion library.sh → etc/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,33 @@ function config()
[[ "$CFGOUT" != "" ]] && echo -e "$CONFIG" > "$CFGOUT"
}


function install_script()
{
(
local SCRIPT=$1
source ./$SCRIPT
echo -e "Installing \e[1m$( basename $SCRIPT .sh )\e[0m"
set +x
install
cleanup
)
}

function configure_script()
{
(
local SCRIPT=$1
cd /usr/local/etc/nextcloudpi-config.d/
config $SCRIPT || return 1 # writes "$INSTALLATION_CODE"
echo -e "$INSTALLATION_CODE" > $SCRIPT # save configuration
source ./$SCRIPT # load configuration
echo -e "Configuring \e[1m$( basename $SCRIPT .sh )\e[0m"
set +x
configure
)
}

function copy_to_image()
{
local IMG=$1
Expand All @@ -223,7 +250,7 @@ function pack_image()
local IMGOUT="$1"
local IMGNAME="$2"
local TARNAME=$( basename $IMGNAME .img ).tar.bz2
echo "copying $IMGNAME$TARNAME"
echo "copying $IMGOUT$IMGNAME"
cp "$IMGOUT" "$IMGNAME" || return 1
echo "packing $IMGNAME$TARNAME"
tar -I pbzip2 -cvf $TARNAME "$IMGNAME" &>/dev/null && \
Expand Down
30 changes: 30 additions & 0 deletions etc/ncp-ascii.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions etc/nextcloudpi-config.d/nc-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# Data dir configuration script for NextCloudPi
# 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 nc-update.sh <IP> (<img>)
#
# See installer.sh instructions for details
#
# More at https://ownyourbits.com/
#

DESCRIPTION="Update NextCloudPi"

configure()
{
/usr/local/bin/ncp-update
}

install() { :; }
cleanup() { :; }

# 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

File renamed without changes.
File renamed without changes.
11 changes: 3 additions & 8 deletions install-nextcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ EXTRACT=1 # Extract the image from zip, so start from 0
IMG=raspbian_lite_latest
INSTALL_SCRIPT=nextcloud.sh

source library.sh # initializes $IMGOUT
source etc/library.sh # initializes $IMGNAME

[[ "$DOWNLOAD" == "1" ]] && { wget https://downloads.raspberrypi.org/$IMG -O $IMG.zip || exit; }
[[ "$DOWNLOAD" == "1" ]] || [[ "$EXTRACT" == "1" ]] && {
Expand All @@ -33,13 +33,8 @@ source library.sh # initializes $IMGOUT

IMGOUT="NextCloudPi_$( date "+%m-%d-%y" ).img"

config $INSTALL_SCRIPT || exit 1
launch_install_qemu "$IMGFILE" $IP || exit 1

CONFDIR=/usr/local/etc/nextcloudpi-config.d/
copy_to_image "$IMGOUT" $CONFDIR nc-limits.sh nc-datadir.sh nc-httpsonly.sh
copy_to_image "$IMGOUT" $CONFDIR/library library.sh
copy_to_image "$IMGOUT" /usr/local/bin/ nextcloudpi-config
config $INSTALL_SCRIPT || exit 1
launch_install_qemu "$IMGFILE" $IP || exit 1 # initializes $IMGOUT

pack_image $IMGFILE $IMGOUT

Expand Down
6 changes: 2 additions & 4 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@
INSTALL_SCRIPT=$1 # First argument is the script to be run inside Raspbian
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 $IMGNAME
source etc/library.sh # initializes $IMGNAME

config $INSTALL_SCRIPT || exit 1

if [[ "$IMGFILE" != "" ]]; then
launch_install_qemu "$IMGFILE" $IP || exit 1 # initializes $IMGOUT
copy_to_image "$IMGOUT" $CONFDIR $INSTALL_SCRIPT || exit 1
launch_install_qemu "$IMGFILE" $IP || exit 1 # initializes $IMGOUT
pack_image "$IMGOUT" "$IMGNAME"
else
launch_installation_online $IP
Expand Down
Loading

0 comments on commit 5892c60

Please sign in to comment.