@@ -1066,6 +1066,40 @@ export PHP_POOL_DIR=/etc/php/"$PHPVER"/fpm/pool.d
1066
1066
print_text_in_color " $IGreen " PHPVER=" $PHPVER "
1067
1067
}
1068
1068
1069
+ add_trusted_key_and_repo () {
1070
+ # EXAMPLE: add_trusted_key_and_repo "jcameron-key.asc" \
1071
+ # "https://download.webmin.com" \
1072
+ # "https://download.webmin.com/download/repository" \
1073
+ # "sarge contrib" \
1074
+ # "webmin-test.list"
1075
+
1076
+ # $1 = whatever.asc
1077
+ # $2 = Key URL e.g. https://download.webmin.com
1078
+ # $3 = Deb URL e.g. https://download.webmin.com/download/repository
1079
+ # $4 = "$CODENAME $CODENAME main" (e.g. jammy jammy main)
1080
+ # $5 = debpackage-name.list
1081
+
1082
+ # This function is only supported in the currently supported release
1083
+ check_distro_version
1084
+
1085
+ # Do the magic
1086
+ if version 22.04 " $DISTRO " 24.04.10
1087
+ then
1088
+ # New recommended way not using apt-key
1089
+ print_text_in_color " $ICyan " " Adding trusted key in /etc/apt/keyrings/$1 ..."
1090
+ curl -sL " $2 " /" $1 " | tee -a /etc/apt/keyrings/" $1 "
1091
+ echo " deb [signed-by=/etc/apt/keyrings/$1 ] $3 $4 " > " /etc/apt/sources.list.d/$5 "
1092
+ apt-get update -q4 & spinner_loading
1093
+ elif version 20.04 " $DISTRO " 20.04.10
1094
+ then
1095
+ # Legacy way with apt-key
1096
+ print_text_in_color " $ICyan " " Adding trusted key with apt-key..."
1097
+ curl -sL " $2 " /" $1 " | apt-key add -
1098
+ echo " deb $3 $4 " > " /etc/apt/sources.list.d/$5 "
1099
+ apt-get update -q4 & spinner_loading
1100
+ fi
1101
+ }
1102
+
1069
1103
# # bash colors
1070
1104
# Reset
1071
1105
Color_Off=' \e[0m' # Text Reset
0 commit comments