52 lines
1.4 KiB
Bash
Executable File
52 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
#------------------------------------------------------------------------
|
|
# Upgrade-Auto - Wrapper to log upgrade of an EOLE server
|
|
# Copyright © 2016 Équipe EOLE <eole@ac-dijon.fr>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
# License, or (at your option) any later version.
|
|
#
|
|
# This program 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 Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
set -e
|
|
|
|
#------------------------------------------------------------------------
|
|
# Delegate help
|
|
#
|
|
if echo "$@" | grep -qse '-h\|--help'
|
|
then
|
|
/usr/share/eole/upgrade/Upgrade-Auto --help
|
|
exit 0
|
|
fi
|
|
|
|
#------------------------------------------------------------------------
|
|
# Open log
|
|
#
|
|
LOG_FILE='/var/log/upgrade-auto.log'
|
|
PIPE="/run/upgrade-auto.fifo"
|
|
|
|
[ ! -p "${PIPE}" ] || rm -f "${PIPE}"
|
|
mkfifo ${PIPE}
|
|
|
|
# Use a function to strip ANSI colors from log
|
|
tee <${PIPE} "${LOG_FILE}" &
|
|
exec 1>&-
|
|
exec 2>&-
|
|
|
|
exec 1> ${PIPE}
|
|
exec 2> ${PIPE}
|
|
|
|
[ ! -p "${PIPE}" ] || rm -f "${PIPE}"
|
|
|
|
/usr/share/eole/upgrade/Upgrade-Auto $@
|