Skip to content

Commit

Permalink
Fri Dec 13 09:31:41 UTC 2024 < glennr-unifi.sh 0.1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
Bashew Runner committed Dec 13, 2024
1 parent 746822e commit 8821e7d
Show file tree
Hide file tree
Showing 103 changed files with 2,415 additions and 1,783 deletions.
42 changes: 24 additions & 18 deletions scripts/controller/unifi-5.10.17.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
###################################################################################################################################################################################################

# Script | UniFi Network Easy Installation Script
# Version | 8.3.0
# Version | 8.3.2
# Application version | 5.10.17
# Debian Repo version | 5.10.17-11638-1
# Author | Glenn Rietveld
Expand Down Expand Up @@ -1861,7 +1861,7 @@ add_mongodb_repo() {
fi
if [[ "${mongodb_org_v::2}" == '44' ]] || [[ "${add_mongodb_44_repo}" == 'true' ]]; then
mongodb_version_major_minor="4.4"
if [[ "${glennr_mongod_compatible}" == "true" ]]; then mongo_version_locked="4.4.18"; fi
if [[ "${avx_compatible}" != "true" ]]; then mongo_version_locked="4.4.18"; fi
if [[ "${try_different_mongodb_repo}" == 'true' ]] || [[ "${architecture}" != "amd64" ]]; then
if [[ "${os_codename}" =~ (stretch|bionic|tara|tessa|tina|tricia|hera|juno) ]]; then
mongodb_codename="ubuntu bionic"
Expand Down Expand Up @@ -2340,6 +2340,7 @@ fi
# Check AVX or not
if [[ "${architecture}" != 'arm64' ]]; then
if ( ! (lscpu 2>/dev/null | grep -iq "avx") && (lscpu 2>/dev/null | grep -iq "sse4_2") ) || ( ! (grep -iq "avx" /proc/cpuinfo) && (grep -iq "sse4_2" /proc/cpuinfo) ); then glennr_mongod_compatible="true"; fi
if (lscpu 2>/dev/null | grep -iq "avx") || (grep -iq "avx" /proc/cpuinfo); then avx_compatible="true"; fi
else
if ! (lscpu 2>/dev/null | grep -iq "avx") || ! grep -iq "avx" /proc/cpuinfo; then glennr_mongod_compatible="true"; fi
fi
Expand Down Expand Up @@ -3703,7 +3704,7 @@ apt_get_install_package() {
attempt_recover_broken_packages
add_apt_option_no_install_recommends="true"; get_apt_options
echo -e "${GRAY_R}#${RESET} Trying to ${apt_get_install_package_variable} ${required_package}..."
if DEBIAN_FRONTEND='noninteractive' apt-get -y "${apt_options[@]}" -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install "${required_package}" 2>&1 | tee -a "${eus_dir}/logs/apt.log" > /tmp/EUS/apt/apt.log; then
if DEBIAN_FRONTEND='noninteractive' apt-get -y "${apt_options[@]}" "${apt_downgrade_option[@]}" -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install "${required_package}" 2>&1 | tee -a "${eus_dir}/logs/apt.log" > /tmp/EUS/apt/apt.log; then
if [[ "${PIPESTATUS[0]}" -eq "0" ]]; then
echo -e "${GREEN}#${RESET} Successfully ${apt_get_install_package_variable_2} ${required_package}! \\n"; sleep 2
else
Expand Down Expand Up @@ -4429,18 +4430,20 @@ mongodb_avx_support_check() {
esac
unset yes_no
else
unset add_mongodb_70_repo
unset add_mongodb_80_repo
add_mongodb_44_repo="true"
mongo_version_max="44"
mongo_version_max_with_dot="4.4"
mongo_version_locked="4.4.18"
if [[ "${avx_compatible}" != 'true' ]]; then
unset add_mongodb_70_repo
unset add_mongodb_80_repo
add_mongodb_44_repo="true"
mongo_version_max="44"
mongo_version_max_with_dot="4.4"
mongo_version_locked="4.4.18"
fi
fi
fi
if [[ "$(dpkg-query --showformat='${Version}' --show jq | sed -e 's/.*://' -e 's/-.*//g' -e 's/[^0-9.]//g' -e 's/\.//g' | sort -V | tail -n1)" -ge "16" ]]; then
jq '.scripts["'"$script_name"'"].tasks += {"mongodb-avx-check ('"$(date +%s)"')": [.scripts["'"$script_name"'"].tasks["mongodb-avx-check ('"$(date +%s)"')"][0] + {"CPU":"'"${cpu_model_name}"'","add_mongodb_44_repo":"'"${add_mongodb_44_repo}"'","mongo_version_max":"'"${mongo_version_max}"'","mongo_version_max_with_dot":"'"${mongo_version_max_with_dot}"'","mongo_version_locked":"'"${mongo_version_locked}"'","Glenn R. MongoDB":"'"${glennr_compiled_mongod}"'","Broken Install Glenn R. MongoDB":"'"${broken_glennr_compiled_mongod}"'"}]}' "${eus_dir}/db/db.json" > "/tmp/EUS/db-avx-debug.json"
jq '.scripts["'"$script_name"'"].tasks += {"mongodb-avx-check ('"$(date +%s)"')": [.scripts["'"$script_name"'"].tasks["mongodb-avx-check ('"$(date +%s)"')"][0] + {"CPU":"'"${cpu_model_name}"'","add_mongodb_44_repo":"'"${add_mongodb_44_repo}"'","mongo_version_max":"'"${mongo_version_max}"'","mongo_version_max_with_dot":"'"${mongo_version_max_with_dot}"'","mongo_version_locked":"'"${mongo_version_locked}"'","Glenn R. MongoDB":"'"${glennr_compiled_mongod}"'","Glenn R. MongoDB Compatible":"'"${glennr_mongod_compatible}"'","Broken Install Glenn R. MongoDB":"'"${broken_glennr_compiled_mongod}"'"}]}' "${eus_dir}/db/db.json" > "/tmp/EUS/db-avx-debug.json"
else
jq --arg script_name "$script_name" --arg date_key "$(date +%s)" --arg cpu_model_name "${cpu_model_name}" --arg add_mongodb_44_repo "$add_mongodb_44_repo" --arg mongo_version_max "$mongo_version_max" --arg mongo_version_max_with_dot "$mongo_version_max_with_dot" --arg mongo_version_locked "$mongo_version_locked" --arg glennr_compiled_mongod "$glennr_compiled_mongod" --arg broken_glennr_compiled_mongod "$broken_glennr_compiled_mongod" '.scripts[$script_name].tasks = (.scripts[$script_name].tasks + {("mongodb-avx-check (" + $date_key + ")"): ((.scripts[$script_name].tasks["mongodb-avx-check (" + $date_key + ")"] // []) + [{"CPU": $cpu_model_name, "add_mongodb_44_repo": $add_mongodb_44_repo, "mongo_version_max": $mongo_version_max, "mongo_version_max_with_dot": $mongo_version_max_with_dot, "mongo_version_locked": $mongo_version_locked, "Glenn R. MongoDB": $glennr_compiled_mongod, "Broken Install Glenn R. MongoDB": $broken_glennr_compiled_mongod}] )})' "${eus_dir}/db/db.json" > "/tmp/EUS/db-avx-debug.json"
jq --arg script_name "$script_name" --arg date_key "$(date +%s)" --arg cpu_model_name "${cpu_model_name}" --arg add_mongodb_44_repo "$add_mongodb_44_repo" --arg mongo_version_max "$mongo_version_max" --arg mongo_version_max_with_dot "$mongo_version_max_with_dot" --arg mongo_version_locked "$mongo_version_locked" --arg glennr_compiled_mongod "$glennr_compiled_mongod" --arg glennr_mongod_compatible "$glennr_mongod_compatible" --arg broken_glennr_compiled_mongod "$broken_glennr_compiled_mongod" '.scripts[$script_name].tasks = (.scripts[$script_name].tasks + {("mongodb-avx-check (" + $date_key + ")"): ((.scripts[$script_name].tasks["mongodb-avx-check (" + $date_key + ")"] // []) + [{"CPU": $cpu_model_name, "add_mongodb_44_repo": $add_mongodb_44_repo, "mongo_version_max": $mongo_version_max, "mongo_version_max_with_dot": $mongo_version_max_with_dot, "mongo_version_locked": $mongo_version_locked, "Glenn R. MongoDB": $glennr_compiled_mongod, "Glenn R. MongoDB Compatible": $glennr_mongod_compatible}, "Broken Install Glenn R. MongoDB": $broken_glennr_compiled_mongod}] )})' "${eus_dir}/db/db.json" > "/tmp/EUS/db-avx-debug.json"
fi
fi
}
Expand Down Expand Up @@ -4510,11 +4513,13 @@ libssl_installation() {
broken_packages_check
attempt_recover_broken_packages
add_apt_option_no_install_recommends="true"; get_apt_options
check_dpkg_lock
if DEBIAN_FRONTEND='noninteractive' apt-get -y "${apt_downgrade_option[@]}" "${apt_options[@]}" -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install "$libssl_temp" &>> "${eus_dir}/logs/libssl.log"; then
echo -e "${GREEN}#${RESET} Successfully installed libssl! \\n"
libssl_install_success="true"
break
else
check_dpkg_lock
if DEBIAN_FRONTEND='noninteractive' "$(which dpkg)" -i "$libssl_temp" &>> "${eus_dir}/logs/libssl.log"; then
echo -e "${GREEN}#${RESET} Successfully installed libssl! \\n"
libssl_install_success="true"
Expand Down Expand Up @@ -5308,9 +5313,9 @@ openjdk_java() {
unifi_dependencies_check() {
if [[ "${required_java_version}" == "openjdk-8" ]]; then
unifi_dependencies_list=( "binutils" "ca-certificates-java" "java-common" "jsvc" "libcommons-daemon-java" )
unifi_dependencies_list=( "binutils" "ca-certificates-java" "java-common" "jsvc" "libcommons-daemon-java" "libcap2" )
else
unifi_dependencies_list=( "binutils" "ca-certificates-java" "java-common" )
unifi_dependencies_list=( "binutils" "ca-certificates-java" "java-common" "libcap2" )
fi
for unifi_dependency in "${unifi_dependencies_list[@]}"; do
if ! "$(which dpkg)" -l "${unifi_dependency}" 2> /dev/null | awk '{print $1}' | grep -iq "^ii\\|^hi\\|^ri\\|^pi\\|^ui"; then
Expand Down Expand Up @@ -5434,7 +5439,8 @@ java_install_check() {
fi
fi
fi
if ! "$(which dpkg)" -l | grep "^ii\\|^hi" | grep -iq "openjdk-${required_java_version_short}\\|temurin-${required_java_version_short}" || [[ "${old_openjdk_version}" == 'true' ]] || [[ "${temurin_jdk_to_jre}" == 'true' ]]; then
if ! "$(which dpkg)" -l | grep "^ii\\|^hi" | grep -iq "openjdk-${required_java_version_short}.*:${architecture}\\|temurin-${required_java_version_short}.*:${architecture}"; then incorrect_architecture_java="true"; java_architecture_flag=":${architecture}"; fi
if ! "$(which dpkg)" -l | grep "^ii\\|^hi" | grep -iq "openjdk-${required_java_version_short}\\|temurin-${required_java_version_short}" || [[ "${incorrect_architecture_java}" == 'true' ]] || [[ "${old_openjdk_version}" == 'true' ]] || [[ "${temurin_jdk_to_jre}" == 'true' ]]; then
if [[ "${old_openjdk_version}" == 'true' ]]; then
header_red
echo -e "${RED}#${RESET} OpenJDK ${required_java_version_short} is to old...\\n" && sleep 2
Expand All @@ -5451,15 +5457,15 @@ java_install_check() {
java_install_attempts="$(apt-cache search --names-only ^"openjdk-${required_java_version_short}-jre-headless|temurin-${required_java_version_short}-jre|temurin-${required_java_version_short}-jdk" | awk '{print $1}' | wc -l)"
until [[ "${java_install_attempts}" == "0" ]]; do
if [[ "${openjdk_available}" == "true" && "${openjdk_attempted}" != 'true' ]]; then
required_package="openjdk-${required_java_version_short}-jre-headless"; apt_get_install_package; openjdk_attempted="true"
required_package="openjdk-${required_java_version_short}-jre-headless${java_architecture_flag}"; apt_get_install_package; openjdk_attempted="true"
if "$(which dpkg)" -l | grep "^ii\\|^hi" | grep -iq "openjdk-${required_java_version_short}-jre-headless"; then break; fi
fi
if [[ "${temurin_available}" == "true" ]]; then
if apt-cache search --names-only ^"temurin-${required_java_version_short}-jre" | grep -ioq "temurin-${required_java_version_short}-jre" && [[ "${temurin_jre_attempted}" != 'true' ]]; then
required_package="temurin-${required_java_version_short}-jre"; apt_get_install_package; temurin_jre_attempted="true"
required_package="temurin-${required_java_version_short}-jre${java_architecture_flag}"; apt_get_install_package; temurin_jre_attempted="true"
if "$(which dpkg)" -l | grep "^ii\\|^hi" | grep -iq "temurin-${required_java_version_short}-jre"; then break; fi
elif apt-cache search --names-only ^"temurin-${required_java_version_short}-jdk" | grep -ioq "temurin-${required_java_version_short}-jdk" && [[ "${temurin_jdk_attempted}" != 'true' ]]; then
required_package="temurin-${required_java_version_short}-jdk"; apt_get_install_package; temurin_jdk_attempted="true"
required_package="temurin-${required_java_version_short}-jdk${java_architecture_flag}"; apt_get_install_package; temurin_jdk_attempted="true"
if "$(which dpkg)" -l | grep "^ii\\|^hi" | grep -iq "temurin-${required_java_version_short}-jdk"; then break; fi
fi
fi
Expand Down Expand Up @@ -6352,7 +6358,7 @@ if [[ "${mongodb_installed}" != 'true' ]]; then
#mongo_version_not_supported="4.5"
mongo_version_max="44"
mongo_version_max_with_dot="4.4"
if [[ "${glennr_mongod_compatible}" == "true" ]]; then mongo_version_locked="4.4.18"; fi
if [[ "${avx_compatible}" != "true" ]]; then mongo_version_locked="4.4.18"; fi
elif [[ "${previous_mongodb_version::2}" == '50' ]]; then
add_mongodb_50_repo="true"
#mongo_version_not_supported="5.1"
Expand Down
Loading

0 comments on commit 8821e7d

Please sign in to comment.