node version logic
This commit is contained in:
@@ -1407,12 +1407,7 @@ def install_node_from_nodesource(version: str):
|
|||||||
raise RuntimeError("Node.js installation failed")
|
raise RuntimeError("Node.js installation failed")
|
||||||
|
|
||||||
|
|
||||||
def install_node_and_yarn(node_pkg: str = None, node_version: str = None):
|
def install_yarn():
|
||||||
if node_version:
|
|
||||||
install_node_from_nodesource(node_version)
|
|
||||||
else:
|
|
||||||
apt_install([node_pkg or "nodejs"])
|
|
||||||
|
|
||||||
if shutil.which("yarn") or shutil.which("yarnpkg"):
|
if shutil.which("yarn") or shutil.which("yarnpkg"):
|
||||||
return
|
return
|
||||||
apt_try_install(["yarn"])
|
apt_try_install(["yarn"])
|
||||||
@@ -1957,7 +1952,7 @@ Paths: app=/opt/npm data=/data cache=/var/lib/angie/cache
|
|||||||
write_file(motd, content, 0o644)
|
write_file(motd, content, 0o644)
|
||||||
|
|
||||||
|
|
||||||
def print_summary(info, ipv6_enabled, dark_enabled, update_mode):
|
def print_summary(info, ipv6_enabled, dark_enabled, tp_theme, update_mode):
|
||||||
ip, angie_v, node_v, yarn_v, npm_v = info
|
ip, angie_v, node_v, yarn_v, npm_v = info
|
||||||
print("\n====================== SUMMARY ======================")
|
print("\n====================== SUMMARY ======================")
|
||||||
print(f"OS: {OSREL['PRETTY']} ({OSREL['ID']} {OSREL['VERSION_ID']})")
|
print(f"OS: {OSREL['PRETTY']} ({OSREL['ID']} {OSREL['VERSION_ID']})")
|
||||||
@@ -1971,7 +1966,11 @@ def print_summary(info, ipv6_enabled, dark_enabled, update_mode):
|
|||||||
print(
|
print(
|
||||||
f"IPv6: {'ENABLED' if ipv6_enabled else 'DISABLED (in configs too)'}"
|
f"IPv6: {'ENABLED' if ipv6_enabled else 'DISABLED (in configs too)'}"
|
||||||
)
|
)
|
||||||
print(f"Dark mode (TP): {'YES' if dark_enabled else 'NO'}")
|
if tp_theme:
|
||||||
|
print(f"Custom theme: {tp_theme}")
|
||||||
|
else:
|
||||||
|
print(f"Custom theme: DISABLED")
|
||||||
|
|
||||||
print(
|
print(
|
||||||
"Paths: /opt/npm (app), /data (data), /etc/angie (conf), /var/log/angie (logs)"
|
"Paths: /opt/npm (app), /data (data), /etc/angie (conf), /var/log/angie (logs)"
|
||||||
)
|
)
|
||||||
@@ -1993,7 +1992,7 @@ def update_only(
|
|||||||
ipv6_enabled: bool,
|
ipv6_enabled: bool,
|
||||||
):
|
):
|
||||||
apt_update_upgrade()
|
apt_update_upgrade()
|
||||||
install_node_and_yarn(node_pkg=node_pkg, node_version=node_version)
|
install_yarn()
|
||||||
|
|
||||||
version = github_latest_release_tag(
|
version = github_latest_release_tag(
|
||||||
"NginxProxyManager/nginx-proxy-manager", npm_version_override
|
"NginxProxyManager/nginx-proxy-manager", npm_version_override
|
||||||
@@ -2199,6 +2198,16 @@ def main():
|
|||||||
print(f"Author: @linuxiarz.pl (Mateusz Gruszczyński)")
|
print(f"Author: @linuxiarz.pl (Mateusz Gruszczyński)")
|
||||||
print("===========================================================\n")
|
print("===========================================================\n")
|
||||||
|
|
||||||
|
if args.tp_theme:
|
||||||
|
dark_mode_enabled = True
|
||||||
|
selected_theme = args.tp_theme
|
||||||
|
elif args.dark_mode:
|
||||||
|
dark_mode_enabled = True
|
||||||
|
selected_theme = TP_DEFAULT_THEME
|
||||||
|
else:
|
||||||
|
dark_mode_enabled = False
|
||||||
|
selected_theme = None
|
||||||
|
|
||||||
if args.update:
|
if args.update:
|
||||||
install_logrotate_for_data_logs()
|
install_logrotate_for_data_logs()
|
||||||
fix_logrotate_permissions_and_wrapper()
|
fix_logrotate_permissions_and_wrapper()
|
||||||
@@ -2218,7 +2227,9 @@ def main():
|
|||||||
)
|
)
|
||||||
info = gather_versions(version)
|
info = gather_versions(version)
|
||||||
update_motd(args.motd == "yes", info, ipv6_enabled=args.enable_ipv6)
|
update_motd(args.motd == "yes", info, ipv6_enabled=args.enable_ipv6)
|
||||||
print_summary(info, args.enable_ipv6, args.dark_mode, update_mode=True)
|
print_summary(
|
||||||
|
info, args.enable_ipv6, args.dark_mode, selected_theme, update_mode=True
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
validate_supported_os()
|
validate_supported_os()
|
||||||
@@ -2260,16 +2271,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
print("IPv6: leaving entries (skipped IPv6 cleanup).")
|
print("IPv6: leaving entries (skipped IPv6 cleanup).")
|
||||||
|
|
||||||
if args.tp_theme:
|
|
||||||
dark_mode_enabled = True
|
|
||||||
selected_theme = args.tp_theme
|
|
||||||
elif args.dark_mode:
|
|
||||||
dark_mode_enabled = True
|
|
||||||
selected_theme = TP_DEFAULT_THEME
|
|
||||||
else:
|
|
||||||
dark_mode_enabled = False
|
|
||||||
selected_theme = None
|
|
||||||
|
|
||||||
if dark_mode_enabled:
|
if dark_mode_enabled:
|
||||||
apply_dark_mode(
|
apply_dark_mode(
|
||||||
APP_FILEPATH="/opt/npm/frontend",
|
APP_FILEPATH="/opt/npm/frontend",
|
||||||
@@ -2294,7 +2295,9 @@ def main():
|
|||||||
|
|
||||||
info = gather_versions(npm_app_version)
|
info = gather_versions(npm_app_version)
|
||||||
update_motd(args.motd == "yes", info, ipv6_enabled=args.enable_ipv6)
|
update_motd(args.motd == "yes", info, ipv6_enabled=args.enable_ipv6)
|
||||||
print_summary(info, args.enable_ipv6, args.dark_mode, update_mode=False)
|
print_summary(
|
||||||
|
info, args.enable_ipv6, args.dark_mode, selected_theme, update_mode=False
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user