mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-10 15:12:01 -03:30
build: fix cleanup
This commit is contained in:
parent
c0cb88088c
commit
86ab526cd9
@ -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
|
||||
|
||||
@ -29,10 +29,11 @@ NO_HALT_STEP=1 ./installer.sh prepare.sh "$IP" "$IMGBASE"
|
||||
./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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
9
lamp.sh
9
lamp.sh
@ -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
|
||||
#
|
||||
|
||||
@ -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 &
|
||||
}
|
||||
|
||||
85
raspbian-cleanup.sh
Normal file
85
raspbian-cleanup.sh
Normal file
@ -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
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
40
update.sh
40
update.sh
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user