#
# Distribution version discovery
#
# Copyright (C) 2014 Red Hat
#
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if [ -z ${_DISTRO_SH+set} ]; then
declare -r _DISTRO_SH=
# Distribution family (lowercase)
# Distribution ID (lowercase)
# Distribution release (lowercase)
if [ -e /etc/redhat-release ]; then
elif [ -e /etc/debian_version ]; then
else
fi
# Distribution branch (lowercase)
# Install packages.
# Args: [pkg_name...]
{
# TODO switch fedora to DNF once
# Pass input to output, fail if a missing package is reported
awk 'BEGIN {s=0}
/^No package .* available.$/ {s=1}
{print}
END {exit s}'
install -- "$@"
# Pass input to output, fail if a missing package is reported
awk 'BEGIN {s=0}
/^No package .* available.$/ {s=1}
{print}
END {exit s}'
[ $# != 0 ] && DEBIAN_FRONTEND=noninteractive \
else
exit 1
fi
}
# Remove packages.
# Args: [pkg_name...]
{
else
exit 1
fi
}
fi # _DISTRO_SH