diff --git a/+POST_INSTALL b/+POST_INSTALL index a72f34137..557b2c681 100644 --- a/+POST_INSTALL +++ b/+POST_INSTALL @@ -21,12 +21,11 @@ EOF cat /etc/rc.bak >> /etc/rc rm -f /etc/rc.bak -echo "Writing package version" +echo "Writing package metadata" mkdir -p /usr/local/opnsense/version if [ -f /usr/local/opnsense/version/opnsense ]; then mv /usr/local/opnsense/version/opnsense /usr/local/opnsense/version/opnsense.last fi - echo "%%CORE_COMMIT%%" > /usr/local/opnsense/version/opnsense echo "%%CORE_NAME%%" > /usr/local/opnsense/version/opnsense.name echo "%%CORE_ABI%%" > /usr/local/opnsense/version/opnsense.abi diff --git a/.gitignore b/.gitignore index d6e11eafc..5c2620e51 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,13 @@ +*.DS_Store +*.codekit +*.mo +*.pyc +*.sass-cache +*.volt.php +/src/etc/php.ini +/src/etc/php/** /src/etc/pkg.conf /src/etc/pkg/** /src/etc/ssh/** -/src/etc/php/** -/src/etc/php.ini /src/lib/** -*.DS_Store -*.codekit -*.sass-cache -*.volt.php -*.pyc -*.mo +/src/opnsense/changelog diff --git a/src/opnsense/scripts/firmware/changelog.sh b/src/opnsense/scripts/firmware/changelog.sh new file mode 100755 index 000000000..52d68de00 --- /dev/null +++ b/src/opnsense/scripts/firmware/changelog.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +# Copyright (c) 2016 Franco Fichtner +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +set -e + +CORE_ABI=$(cat /usr/local/opnsense/version/opnsense.abi 2> /dev/null) +SYS_ABI=$(opnsense-verify -a 2> /dev/null) + +URL="https://pkg.opnsense.org" +URL="${URL}/${SYS_ABI}/${CORE_ABI}" +URL="${URL}/sets/changelog.txz" + +DESTDIR="/usr/local/opnsense/changelog" +WORKDIR="/tmp/changelog" +FETCH="fetch -aqT 30" + +rm -rf ${WORKDIR} +mkdir -p ${WORKDIR} + +${FETCH} -o ${WORKDIR}/changelog.txz.sig "${URL}.sig" +${FETCH} -o ${WORKDIR}/changelog.txz "${URL}" +opnsense-verify -q ${WORKDIR}/changelog.txz + +mkdir -p ${DESTDIR} +rm ${DESTDIR}/* + +tar -C ${DESTDIR} -xJf ${WORKDIR}/changelog.txz diff --git a/src/opnsense/scripts/firmware/check.sh b/src/opnsense/scripts/firmware/check.sh index 9b2fc284a..1a39b6039 100755 --- a/src/opnsense/scripts/firmware/check.sh +++ b/src/opnsense/scripts/firmware/check.sh @@ -62,6 +62,8 @@ tmp_pkg_update_file="/tmp/pkg_updates.output" # Check if pkg is already runnig pkg_running=`ps -x | grep "pkg " | grep -v "grep"` if [ "$pkg_running" == "" ]; then + # load changelogs first + /usr/local/opnsense/scripts/firmware/changelog.sh # start pkg update pkg update -f > $tmp_pkg_update_file & pkg_running="started" # Set running state to arbitrary value