diff options
-rw-r--r-- | armbian.sh | 6 | ||||
-rwxr-xr-x | build-SD.sh | 13 | ||||
-rw-r--r-- | build-devel.sh | 12 | ||||
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | docker/docker-env.sh | 3 | ||||
-rw-r--r-- | install.sh | 9 | ||||
-rw-r--r-- | lamp.sh | 9 | ||||
-rw-r--r-- | nextcloudpi.sh | 46 | ||||
-rw-r--r-- | prepare.sh | 6 | ||||
-rw-r--r-- | raspbian-cleanup.sh | 85 | ||||
-rw-r--r-- | remote-update.sh | 2 | ||||
-rwxr-xr-x | update.sh | 40 |
12 files changed, 122 insertions, 111 deletions
@@ -34,6 +34,12 @@ Main() { # install NCP curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash + # cleanup + apt-get autoremove -y + apt-get clean + rm /var/lib/apt/lists/* -r + rm /.ncp-image + ;; esac } # Main diff --git a/build-SD.sh b/build-SD.sh index 739413a5..d9960026 100755 --- a/build-SD.sh +++ b/build-SD.sh @@ -24,15 +24,16 @@ 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 +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 # ./installer.sh build-devel.sh "$IP" "$( ls -1t *.img | head -1 )" || exit 1 IMGFILE=$( ls -1t *.img | head -1 ) -IMGNAME=$( basename "$IMGFILE" _base_prepare_lamp_nc-nextcloud_nextcloudpi_nc-init.img ) +IMGNAME=$( basename "$IMGFILE" _base_prepare_lamp_nc-nextcloud_nextcloudpi_nc-init_raspbian-cleanup.img ) [[ "$IMGNAME" != "" ]] || exit 1 diff --git a/build-devel.sh b/build-devel.sh index 489f6bd0..b37e81e3 100644 --- a/build-devel.sh +++ b/build-devel.sh @@ -46,9 +46,19 @@ install() } -cleanup() { :; } configure() { :; } +cleanup() +{ + apt-get autoremove -y + apt-get clean + rm -rf /var/lib/apt/lists/* + rm -f /home/pi/.bash_history + 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 diff --git a/changelog.md b/changelog.md index a579d1ed..9fedbef1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,6 @@ +[v0.37.3](https://github.com/nextcloud/nextcloudpi/commit/a9fcded) (2017-11-24) build: fix cleanup + [v0.37.2 ](https://github.com/nextcloud/nextcloudpi/commit/529f9de) (2017-11-20) nc-datadir: dont create dir if not exists [v0.37.1 ](https://github.com/nextcloud/nextcloudpi/commit/a97bc07) (2017-11-19) nc-restore: fix restore passwod diff --git a/docker/docker-env.sh b/docker/docker-env.sh index 70c9bc04..1c9c8c4d 100644 --- a/docker/docker-env.sh +++ b/docker/docker-env.sh @@ -23,8 +23,7 @@ cleanup() apt-get clean rm /var/lib/apt/lists/* -r rm -f /home/pi/.bash_history - - systemctl disable ssh + rm -f /etc/udev/rules.d/90-qemu.rules } # License @@ -56,15 +56,6 @@ activate_script etc/nextcloudpi-config.d/nc-init.sh cd - rm -rf $TMPDIR -# extra cleanup only in image generation -[[ -f /.ncp-image ]] && { - apt-get autoremove -y - apt-get clean - rm /var/lib/apt/lists/* -r - rm /.ncp-image -} - - echo "Done. Type 'sudo nextcloudpi-config' to configure NCP @@ -137,15 +137,6 @@ EOF configure() { :; } -cleanup() -{ - apt-get autoremove -y - apt-get clean - rm /var/lib/apt/lists/* -r - rm -f /home/pi/.bash_history - - systemctl disable ssh -} # License # diff --git a/nextcloudpi.sh b/nextcloudpi.sh index d07325f5..cf12719b 100644 --- a/nextcloudpi.sh +++ b/nextcloudpi.sh @@ -204,52 +204,6 @@ EOF configure() { :; } -cleanup() -{ - apt-get autoremove -y - apt-get clean - rm /var/lib/apt/lists/* -r - rm -f /home/pi/.bash_history - - # remove QEMU specific rules - rm -f /etc/udev/rules.d/90-qemu.rules - - # restore expand filesystem on first boot - cat > /etc/init.d/resize2fs_once <<'EOF' -#!/bin/sh -### BEGIN INIT INFO -# Provides: resize2fs_once -# Required-Start: -# Required-Stop: -# Default-Start: 3 -# Default-Stop: -# Short-Description: Resize the root filesystem to fill partition -# Description: -### END INIT INFO - -. /lib/lsb/init-functions - -case "$1" in - start) - log_daemon_msg "Starting resize2fs_once" && \ - resize2fs /dev/mmcblk0p2 && \ - update-rc.d resize2fs_once remove && \ - rm /etc/init.d/resize2fs_once && \ - log_end_msg $? - ;; - *) - echo "Usage: $0 start" >&2 - exit 3 - ;; -esac -EOF - chmod +x /etc/init.d/resize2fs_once - systemctl enable resize2fs_once - - rm /.ncp-image - - systemctl disable ssh -} # License # @@ -47,12 +47,6 @@ configure(){ :; } cleanup() { [ "$STATE" != "0" ] && return - apt-get autoremove - apt-get clean - rm /var/lib/apt/lists/* -r - rm -f /home/pi/.bash_history - - systemctl disable ssh rm $STATE_FILE nohup halt &>/dev/null & } diff --git a/raspbian-cleanup.sh b/raspbian-cleanup.sh new file mode 100644 index 00000000..76ffa522 --- /dev/null +++ b/raspbian-cleanup.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# Cleanup step Raspbian image +# +# 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 raspbian-cleanup.sh <IP> (<img>) +# +# See installer.sh instructions for details +# +# More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/ +# + +install() { :; } +configure() { :; } + +cleanup() +{ + # clean packages + apt-get autoremove -y + apt-get clean + rm /var/lib/apt/lists/* -r + rm -f /home/pi/.bash_history + + # restore expand filesystem on first boot + cat > /etc/init.d/resize2fs_once <<'EOF' +#!/bin/sh +### BEGIN INIT INFO +# Provides: resize2fs_once +# Required-Start: +# Required-Stop: +# Default-Start: 3 +# Default-Stop: +# Short-Description: Resize the root filesystem to fill partition +# Description: +### END INIT INFO + +. /lib/lsb/init-functions + +case "$1" in + start) + log_daemon_msg "Starting resize2fs_once" && \ + resize2fs /dev/mmcblk0p2 && \ + update-rc.d resize2fs_once remove && \ + rm /etc/init.d/resize2fs_once && \ + log_end_msg $? + ;; + *) + echo "Usage: $0 start" >&2 + exit 3 + ;; +esac +EOF + chmod +x /etc/init.d/resize2fs_once + systemctl enable resize2fs_once + + # remove QEMU specific rules + rm -f /etc/udev/rules.d/90-qemu.rules + + # clean build flags + rm /.ncp-image + + # disable SSH + 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/remote-update.sh b/remote-update.sh index 03def133..66471622 100644 --- a/remote-update.sh +++ b/remote-update.sh @@ -25,7 +25,7 @@ cleanup() rm -rf /var/lib/apt/lists/* rm -f /home/pi/.bash_history 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 } @@ -1,6 +1,6 @@ #!/bin/bash -# Updaterfor NextCloudPi +# Updater for 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! @@ -115,35 +115,6 @@ done # only for image builds [[ ! -f /.ncp-image ]] && { - # fix notify unattended upgrades repeating lines - cat > /usr/local/bin/ncp-notify-unattended-upgrade <<EOF -#!/bin/bash -LOGFILE=/var/log/unattended-upgrades/unattended-upgrades.log -STAMPFILE=/var/run/.ncp-notify-unattended-upgrades -VERFILE=/usr/local/etc/ncp-version - -test -e "\$LOGFILE" || { echo "\$LOGFILE not found"; exit 1; } - -test -e "\$STAMPFILE" || touch "\$STAMPFILE" - -[ \$( date -r "\$LOGFILE" +'%y%m%d%H%M' ) -le \$( date -r "\$STAMPFILE" +'%y%m%d%H%M' ) ] && { echo "info is up to date"; exit 0; } - -LINE=\$( grep "INFO Packages that will be upgraded" "\$LOGFILE" | tail -1 ) - -[[ "\$LINE" == "" ]] && { echo "no new upgrades"; touch "\$STAMPFILE"; exit 0; } - -PKGS=\$( sed 's|^.*Packages that will be upgraded: ||' <<< "\$LINE" ) - -echo "Packages automatically upgraded: \$PKGS" - -touch "\$STAMPFILE" - -sudo -u www-data php /var/www/nextcloud/occ notification:generate \ - $USER_ "NextCloudPi Unattended Upgrades" \ - -l "Packages automatically upgraded \$PKGS" -EOF - chmod +x /usr/local/bin/ncp-notify-unattended-upgrade - # log adjustment for wizard test -f /home/www/ncp-launcher.sh && \ cat > /home/www/ncp-launcher.sh <<'EOF' @@ -261,7 +232,7 @@ EOF chmod +x /usr/local/bin/ncp-notify-unattended-upgrade # fix modsecurity uploads - sed -i 's|^SecRequestBodyLimit ^C|#SecRequestBodyLimit 13107200|' /etc/modsecurity/modsecurity.conf + sed -i 's|^SecRequestBodyLimit .*|#SecRequestBodyLimit 13107200|' /etc/modsecurity/modsecurity.conf # fix ramlogs [[ $( grep "^ACTIVE_" /usr/local/etc/nextcloudpi-config.d/nc-ramlogs.sh | cut -f2 -d'=' ) == "yes" ]] && { @@ -292,6 +263,13 @@ chown redis /var/log/redis EOF systemctl enable ramlogs } + + # fix automount in latest images + test -f /etc/udev/rules.d/90-qemu.rules && { + rm -f /etc/udev/rules.d/90-qemu.rules + udevadm control --reload-rules && udevadm trigger + pgrep -c udiskie &>/dev/null && systemctl restart nc-automount + } } exit 0 |