Added support for Clear Linux in `install-required-packages.sh`. (#8154)
* Disable shellcheck 2034 due to computed variable names. This particular check throws a large number of false positives in this file because it cannot see us using the mappings from packages to per-distro package names since we're accessign them through computed variable names. * Add Clear Linux support to install-required-packages.sh This adds preliminary support for Clear Linux to the install-required-packages script, which allows users to use the regular kickstart install script there. As of right now, this has a significant limitation in that Clear Linux does not provide a package for libJudy, meaning that users will not be able to use the dbengine.
Austin S. Hemmelgarn committed
Feb 22, 2020 at 10:51 UTC
119921db74da16e6e12dfc3acdf6b243978c4255
1 file changed
+87
-3
packaging/installer/install-required-packages.sh
+87
-3
@@ -1,4 +1,6 @@
1
#!/usr/bin/env bash
2
+# shellcheck disable=SC2034
3
+# We use lots of computed variable names in here, so we need to disable shellcheck 2034
4
5
export PATH="${PATH}:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
6
export LC_ALL=C
@@ -41,6 +43,7 @@ dnf=$(command -v dnf 2> /dev/null)
43
emerge=$(command -v emerge 2> /dev/null)
44
equo=$(command -v equo 2> /dev/null)
45
pacman=$(command -v pacman 2> /dev/null)
46
+swupd=$(command -v swupd 2> /dev/null)
47
yum=$(command -v yum 2> /dev/null)
48
zypper=$(command -v zypper 2> /dev/null)
49
@@ -73,6 +76,7 @@ Supported distributions (DD):
76
- debian, ubuntu (all Debian and Ubuntu derivatives)
77
- redhat, fedora (all Red Hat and Fedora derivatives)
78
- suse, opensuse (all SuSe and openSuSe derivatives)
79
+ - clearlinux (all Clear Linux derivatives)
80
81
Supported installers (IN):
82
@@ -84,6 +88,7 @@ Supported installers (IN):
88
- yum all Red Hat / Fedora / CentOS Linux derivatives
89
- zypper all SuSe Linux derivatives
90
- apk all Alpine derivatives
91
+ - swupd all Clear Linux derivatives
92
93
Supported packages (you can append many of them):
94
@@ -187,7 +192,7 @@ get_os_release() {
192
eval "$(grep -E "^(NAME|ID|ID_LIKE|VERSION|VERSION_ID)=" "${os_release_file}")"
193
for x in "${ID}" ${ID_LIKE}; do
194
case "${x,,}" in
190
- alpine | arch | centos | debian | fedora | gentoo | sabayon | rhel | ubuntu | suse | opensuse-leap | sles)
195
+ alpine | arch | centos | debian | fedora | gentoo | sabayon | rhel | ubuntu | suse | opensuse-leap | sles | clear-linux-os)
196
distribution="${x}"
197
version="${VERSION_ID}"
198
codename="${VERSION}"
@@ -279,7 +284,7 @@ user_picks_distribution() {
284
exit 1
285
fi
286
282
- if [ -z "${equo}" ] && [ -z "${emerge}" ] && [ -z "${apt_get}" ] && [ -z "${yum}" ] && [ -z "${dnf}" ] && [ -z "${pacman}" ] && [ -z "${apk}" ]; then
287
+ if [ -z "${equo}" ] && [ -z "${emerge}" ] && [ -z "${apt_get}" ] && [ -z "${yum}" ] && [ -z "${dnf}" ] && [ -z "${pacman}" ] && [ -z "${apk}" ] && [ -z "${swupd}" ]; then
288
echo >&2 "And it seems I cannot find a known package manager in this system."
289
echo >&2 "Please open a github issue to help us support your system too."
290
exit 1
@@ -296,6 +301,7 @@ user_picks_distribution() {
301
[ -n "${emerge}" ] && echo >&2 " - Gentoo based (installer is: emerge)" && opts="emerge ${opts}"
302
[ -n "${equo}" ] && echo >&2 " - Sabayon based (installer is: equo)" && opts="equo ${opts}"
303
[ -n "${apk}" ] && echo >&2 " - Alpine Linux based (installer is: apk)" && opts="apk ${opts}"
304
+ [ -n "${swupd}" ] && echo >&2 " - Clear Linux based (installer is: swupd)" && opts="swupd ${opts}"
305
echo >&2
306
307
REPLY=
@@ -411,6 +417,15 @@ detect_package_manager_from_distribution() {
417
fi
418
;;
419
420
+ clear-linux* | clearlinux* )
421
+ package_installer="install_swupd"
422
+ tree="clearlinux"
423
+ if [ "${IGNORE_INSTALLED}" -eq 0 ] && [ -z "${swupd}" ]; then
424
+ echo >&2 "command 'swupd' is required to install packages on a '${distribution} ${version}' system."
425
+ exit 1
426
+ fi
427
+ ;;
428
+
429
*)
430
# oops! unknown system
431
user_picks_distribution
@@ -494,6 +509,14 @@ check_package_manager() {
509
return 0
510
;;
511
512
+ swupd)
513
+ [ "${IGNORE_INSTALLED}" -eq 0 ] && [ -z "${swupd}" ] && echo >&2 "${1} is not available." && return 1
514
+ package_installer="install_swupd"
515
+ tree="clear-linux"
516
+ detection="user-input"
517
+ return 0
518
+ ;;
519
+
520
*)
521
echo >&2 "Invalid package manager: '${1}'."
522
return 1
@@ -521,6 +544,7 @@ require_cmd() {
544
545
declare -A pkg_find=(
546
['fedora']="findutils"
547
+ ['clearlinux']="findutils"
548
['default']="WARNING|"
549
)
550
@@ -531,6 +555,7 @@ declare -A pkg_distro_sdk=(
555
556
declare -A pkg_autoconf=(
557
['gentoo']="sys-devel/autoconf"
558
+ ['clearlinux']="c-basic"
559
['default']="autoconf"
560
)
561
@@ -538,6 +563,7 @@ declare -A pkg_autoconf=(
563
# https://github.com/firehol/netdata/pull/450
564
declare -A pkg_autoconf_archive=(
565
['gentoo']="sys-devel/autoconf-archive"
566
+ ['clearlinux']="c-basic"
567
['alpine']="WARNING|"
568
['default']="autoconf-archive"
569
@@ -549,6 +575,7 @@ declare -A pkg_autoconf_archive=(
575
576
declare -A pkg_autogen=(
577
['gentoo']="sys-devel/autogen"
578
+ ['clearlinux']="c-basic"
579
['alpine']="WARNING|"
580
['default']="autogen"
581
@@ -560,15 +587,18 @@ declare -A pkg_autogen=(
587
588
declare -A pkg_automake=(
589
['gentoo']="sys-devel/automake"
590
+ ['clearlinux']="c-basic"
591
['default']="automake"
592
)
593
594
declare -A pkg_bridge_utils=(
595
['gentoo']="net-misc/bridge-utils"
596
+ ['clearlinux']="network-basic"
597
['default']="bridge-utils"
598
)
599
600
declare -A pkg_chrony=(
601
+ ['clearlinux']="time-server-basic"
602
['default']="chrony"
603
)
604
@@ -583,6 +613,7 @@ declare -A pkg_gzip=(
613
)
614
615
declare -A pkg_tar=(
616
+ ['clearlinux']="os-core-update"
617
['default']="tar"
618
)
619
@@ -593,6 +624,7 @@ declare -A pkg_git=(
624
625
declare -A pkg_gcc=(
626
['gentoo']="sys-devel/gcc"
627
+ ['clearlinux']="c-basic"
628
['default']="gcc"
629
)
630
@@ -610,6 +642,7 @@ declare -A pkg_iproute2=(
642
['debian']="iproute2"
643
['gentoo']="sys-apps/iproute2"
644
['sabayon']="sys-apps/iproute2"
645
+ ['clearlinux']="iproute2"
646
['default']="iproute"
647
648
# exceptions
@@ -618,6 +651,7 @@ declare -A pkg_iproute2=(
651
652
declare -A pkg_ipset=(
653
['gentoo']="net-firewall/ipset"
654
+ ['clearlinux']="network-basic"
655
['default']="ipset"
656
)
657
@@ -640,6 +674,7 @@ declare -A pkg_libz_dev=(
674
['sabayon']="sys-libs/zlib"
675
['rhel']="zlib-devel"
676
['suse']="zlib-devel"
677
+ ['clearlinux']="devpkg-zlib"
678
['default']=""
679
)
680
@@ -664,6 +699,7 @@ declare -A pkg_libmnl_dev=(
699
['sabayon']="net-libs/libmnl"
700
['rhel']="libmnl-devel"
701
['suse']="libmnl-devel"
702
+ ['clearlinux']="devpkg-libmnl"
703
['default']=""
704
)
705
@@ -676,18 +712,22 @@ declare -A pkg_lm_sensors=(
712
['sabayon']="sys-apps/lm_sensors"
713
['rhel']="lm_sensors"
714
['suse']="sensors"
715
+ ['clearlinux']="lm-sensors"
716
['default']="lm_sensors"
717
)
718
719
declare -A pkg_logwatch=(
720
+ ['clearlinux']="WARNING|"
721
['default']="logwatch"
722
)
723
724
declare -A pkg_lxc=(
725
+ ['clearlinux']="WARNING|"
726
['default']="lxc"
727
)
728
729
declare -A pkg_mailutils=(
730
+ ['clearlinux']="WARNING|"
731
['default']="mailutils"
732
)
733
@@ -705,6 +745,7 @@ declare -A pkg_netcat=(
745
['sabayon']="net-analyzer/gnu-netcat"
746
['rhel']="nmap-ncat"
747
['suse']="netcat-openbsd"
748
+ ['clearlinux']="sysadmin-basic"
749
['default']="netcat"
750
751
# exceptions
@@ -719,6 +760,7 @@ declare -A pkg_nginx=(
760
761
declare -A pkg_nodejs=(
762
['gentoo']="net-libs/nodejs"
763
+ ['clearlinux']="nodejs-basic"
764
['default']="nodejs"
765
766
# exceptions
@@ -742,12 +784,14 @@ declare -A pkg_pkg_config=(
784
['sabayon']="virtual/pkgconfig"
785
['rhel']="pkgconfig"
786
['suse']="pkg-config"
787
+ ['clearlinux']="c-basic"
788
['default']="pkg-config"
789
)
790
791
declare -A pkg_python=(
792
['gentoo']="dev-lang/python"
793
['sabayon']="dev-lang/python:2.7"
794
+ ['clearlinux']="python-basic"
795
['default']="python"
796
797
# Exceptions
@@ -763,6 +807,7 @@ declare -A pkg_python_mysqldb=(
807
['sabayon']="dev-python/mysqlclient"
808
['rhel']="MySQL-python"
809
['suse']="python-PyMySQL"
810
+ ['clearlinux']="WARNING|"
811
['default']="python-mysql"
812
813
# exceptions
@@ -778,6 +823,7 @@ declare -A pkg_python3_mysqldb=(
823
['sabayon']="dev-python/mysqlclient"
824
['rhel']="WARNING|"
825
['suse']="WARNING|"
826
+ ['clearlinux']="WARNING|"
827
['default']="WARNING|"
828
829
# exceptions
@@ -803,6 +849,7 @@ declare -A pkg_python_psycopg2=(
849
['sabayon']="dev-python/psycopg:2"
850
['rhel']="python-psycopg2"
851
['suse']="python-psycopg2"
852
+ ['clearlinux']="WARNING|"
853
['default']="python-psycopg2"
854
)
855
@@ -815,6 +862,7 @@ declare -A pkg_python3_psycopg2=(
862
['sabayon']="dev-python/psycopg:2"
863
['rhel']="WARNING|"
864
['suse']="WARNING|"
865
+ ['clearlinux']="WARNING|"
866
['default']="WARNING|"
867
)
868
@@ -822,6 +870,7 @@ declare -A pkg_python_pip=(
870
['alpine']="py-pip"
871
['gentoo']="dev-python/pip"
872
['sabayon']="dev-python/pip"
873
+ ['clearlinux']="python-basic"
874
['default']="python-pip"
875
)
876
@@ -832,6 +881,7 @@ declare -A pkg_python3_pip=(
881
['gentoo']="dev-python/pip"
882
['sabayon']="dev-python/pip"
883
['rhel']="WARNING|"
884
+ ['clearlinux']="python3-basic"
885
['default']="python3-pip"
886
)
887
@@ -842,6 +892,7 @@ declare -A pkg_python_pymongo=(
892
['debian']="python-pymongo"
893
['gentoo']="dev-python/pymongo"
894
['suse']="python-pymongo"
895
+ ['clearlinux']="WARNING|"
896
['default']="python-pymongo"
897
)
898
@@ -852,6 +903,7 @@ declare -A pkg_python3_pymongo=(
903
['debian']="python3-pymongo"
904
['gentoo']="dev-python/pymongo"
905
['suse']="python3-pymongo"
906
+ ['clearlinux']="WARNING|"
907
['default']="python3-pymongo"
908
)
909
@@ -864,6 +916,7 @@ declare -A pkg_python_requests=(
916
['sabayon']="dev-python/requests"
917
['rhel']="python-requests"
918
['suse']="python-requests"
919
+ ['clearlinux']="python-extras"
920
['default']="python-requests"
921
['alpine-3.1.4']="WARNING|"
922
['alpine-3.2.3']="WARNING|"
@@ -878,6 +931,7 @@ declare -A pkg_python3_requests=(
931
['sabayon']="dev-python/requests"
932
['rhel']="WARNING|"
933
['suse']="WARNING|"
934
+ ['clearlinux']="python-extras"
935
['default']="WARNING|"
936
)
937
@@ -887,6 +941,7 @@ declare -A pkg_lz4=(
941
['ubuntu']="liblz4-dev"
942
['suse']="liblz4-devel"
943
['gentoo']="app-arch/lz4"
944
+ ['clearlinux']="devpkg-lz4"
945
['default']="lz4-devel"
946
)
947
@@ -896,6 +951,7 @@ declare -A pkg_libuv=(
951
['ubuntu']="libuv1-dev"
952
['gentoo']="dev-libs/libuv"
953
['arch']="libuv"
954
+ ['clearlinux']="devpkg-libuv"
955
['default']="libuv-devel"
956
)
957
@@ -904,11 +960,13 @@ declare -A pkg_openssl=(
960
['debian']="libssl-dev"
961
['ubuntu']="libssl-dev"
962
['suse']="libopenssl-devel"
963
+ ['clearlinux']="devpkg-openssl"
964
['default']="openssl-devel"
965
)
966
967
declare -A pkg_judy=(
911
- ['alpine']="WARNING|" # TODO - need to add code to download and install judy for alpine case
968
+ ['alpine']="WARNING|" # TODO - need to add code to download and install judy for alpine and clearlinux
969
+ ['clearlinux']="WARNING|"
970
['debian']="libjudy-dev"
971
['ubuntu']="libjudy-dev"
972
['suse']="judy-devel"
@@ -920,6 +978,7 @@ declare -A pkg_judy=(
978
declare -A pkg_python3=(
979
['gentoo']="dev-lang/python"
980
['sabayon']="dev-lang/python:3.4"
981
+ ['clearlinux']="python3-basic"
982
['default']="python3"
983
984
# exceptions
@@ -929,6 +988,7 @@ declare -A pkg_python3=(
988
declare -A pkg_screen=(
989
['gentoo']="app-misc/screen"
990
['sabayon']="app-misc/screen"
991
+ ['clearlinux']="sysadmin-basic"
992
['default']="screen"
993
)
994
@@ -942,12 +1002,14 @@ declare -A pkg_sysstat=(
1002
1003
declare -A pkg_tcpdump=(
1004
['gentoo']="net-analyzer/tcpdump"
1005
+ ['clearlinux']="network-basic"
1006
['default']="tcpdump"
1007
)
1008
1009
declare -A pkg_traceroute=(
1010
['alpine']=" "
1011
['gentoo']="net-analyzer/traceroute"
1012
+ ['clearlinux']="network-basic"
1013
['default']="traceroute"
1014
)
1015
@@ -959,6 +1021,7 @@ declare -A pkg_valgrind=(
1021
declare -A pkg_ulogd=(
1022
['centos']="WARNING|"
1023
['rhel']="WARNING|"
1024
+ ['clearlinux']="WARNING|"
1025
['gentoo']="app-admin/ulogd"
1026
['default']="ulogd2"
1027
)
@@ -1535,6 +1598,27 @@ install_zypper() {
1598
run ${sudo} zypper "${zypper_opts[@]}" install "${@}"
1599
}
1600
1601
+# -----------------------------------------------------------------------------
1602
+# clearlinux
1603
+
1604
+validate_install_swupd() {
1605
+ swupd bundle-list | grep -q "${*}" || echo "${*}"
1606
+}
1607
+
1608
+install_swupd() {
1609
+ # download the latest package info
1610
+ if [ "${DRYRUN}" -eq 1 ]; then
1611
+ echo >&2 " >> IMPORTANT << "
1612
+ echo >&2 " Please make sure your system is up to date"
1613
+ echo >&2 " by running: ${sudo} swupd update "
1614
+ echo >&2
1615
+ fi
1616
+
1617
+ run ${sudo} swupd bundle-add "${@}"
1618
+}
1619
+
1620
+# -----------------------------------------------------------------------------
1621
+
1622
install_failed() {
1623
local ret="${1}"
1624
cat << EOF