2023-11-27 14:38:21 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
#
|
|
|
|
# This program 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 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 <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
. "$(dirname $0)"/../../scripts/misc/sysexits.sh
|
|
|
|
|
|
|
|
true=0
|
|
|
|
false=1
|
|
|
|
progname="resources/packages/dependencies/install"
|
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
progname="$1"
|
|
|
|
|
|
|
|
printf "Usage:\n"
|
|
|
|
printf "\t%s --help\n" \ "${progname}"
|
|
|
|
printf "\t%s # Install dependencies for GNU Boot\n" \ "${progname}"
|
|
|
|
}
|
|
|
|
|
|
|
|
is_base_distro()
|
|
|
|
{
|
2023-12-09 18:00:38 +01:00
|
|
|
distro="$1"
|
2023-11-27 14:38:21 +01:00
|
|
|
grep "ID=${distro}" /etc/os-release > /dev/null && return ${true}
|
|
|
|
grep "ID_LIKE=${distro}" /etc/os-release > /dev/null && return ${true}
|
|
|
|
return ${false}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if [ $# -eq 1 ] && [ "$1" == "--help" ] ; then
|
|
|
|
usage "${progname}"
|
|
|
|
exit 0
|
2023-12-09 17:52:57 +01:00
|
|
|
elif [ $# -ne 0 ] ; then
|
2023-11-27 14:38:21 +01:00
|
|
|
usage "${progname}"
|
|
|
|
exit ${EX_USAGE}
|
|
|
|
fi
|
|
|
|
|
2023-12-09 18:07:52 +01:00
|
|
|
# Try to detect distributions derived from other distributions first
|
|
|
|
# as for instance Trisquel 10 has ID_LIKE=debian and not
|
|
|
|
# ID_LIKE=ubuntu.
|
|
|
|
if is_base_distro "trisquel" ; then
|
2024-11-29 20:14:22 +01:00
|
|
|
"$(dirname $0)"/../../dependencies/pureos-trisquel $@
|
2023-12-09 18:07:52 +01:00
|
|
|
exit $?
|
|
|
|
elif is_base_distro "pureos" ; then # PureOS doesn't have ID_LIKE
|
2024-11-29 20:14:22 +01:00
|
|
|
"$(dirname $0)"/../../dependencies/pureos-trisquel $@
|
2023-12-09 18:07:52 +01:00
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
2023-11-27 14:38:21 +01:00
|
|
|
if is_base_distro "arch" ; then
|
2023-12-09 17:57:20 +01:00
|
|
|
"$(dirname $0)"/../../dependencies/arch $@
|
2023-11-27 14:38:21 +01:00
|
|
|
elif is_base_distro "debian" ; then
|
2024-11-29 20:14:22 +01:00
|
|
|
"$(dirname $0)"/../../dependencies/pureos-trisquel $@
|
2023-11-27 14:38:21 +01:00
|
|
|
elif is_base_distro "fedora" ; then
|
2023-12-09 17:57:20 +01:00
|
|
|
"$(dirname $0)"/../../dependencies/fedora35 $@
|
2023-11-27 14:38:21 +01:00
|
|
|
elif is_base_distro "ubuntu" ; then
|
2024-11-29 20:14:22 +01:00
|
|
|
"$(dirname $0)"/../../dependencies/pureos-trisquel $@
|
2023-11-27 14:38:21 +01:00
|
|
|
elif is_base_distro "void" ; then
|
2023-12-09 17:57:20 +01:00
|
|
|
"$(dirname $0)"/../../dependencies/void $@
|
2023-11-27 14:38:21 +01:00
|
|
|
fi
|