From 470c36fc4f5126756e0b7f2a7e52de71f033aa27 Mon Sep 17 00:00:00 2001 From: pika Date: Mon, 19 May 2025 10:12:38 +0200 Subject: [PATCH] wip --- distros.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/distros.sh b/distros.sh index 182493b..62f9fee 100755 --- a/distros.sh +++ b/distros.sh @@ -155,7 +155,7 @@ checkAndInstall() { } # ─< Check if the user is root and set sudo variable if necessary >─────────────────────── -check_root() { +check_env() { if [ "$(id -u)" -ne 0 ]; then if command_exists sudo; then echo_info "User is not root. Using sudo for privileged operations." @@ -168,6 +168,12 @@ check_root() { echo_info "Root access confirmed." _sudo="" fi + + pikaCheckFile="$HOME/.cache/pika_script_detection" + + if [ -e "$pikaCheckFile" ]; then + PIKA_INIT=true + fi } _setup() { @@ -396,18 +402,19 @@ update_package_list() { alpine) run $_sudo apk update ;; *) echo_error "Unsupported distribution: ${BRIGHT_RED}$distro" ;; esac - } -if check_root; then +if check_env; then get_packager dist_setup if [[ -z "$PIKA_INIT" ]]; then - echo_info "First time being imported.." - export PIKA_INIT=true + echo_pkg "First time being imported.." + touch "$pikaCheckFile" update_package_list + else + echo_note "Skipping repo refresh (PIKA_INIT is already set)" fi fi