mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
Test
This commit is contained in:
@@ -62,7 +62,7 @@ function x(){
|
|||||||
function showfun(){
|
function showfun(){
|
||||||
echo -e "${STY_BLUE}[$0]: The definition of function \"$1\" is as follows:${STY_RST}"
|
echo -e "${STY_BLUE}[$0]: The definition of function \"$1\" is as follows:${STY_RST}"
|
||||||
printf "${STY_GREEN}"
|
printf "${STY_GREEN}"
|
||||||
type -a $1
|
type -a "$1" 2>/dev/null || type -a "$1".sh 2>/dev/null || return 1
|
||||||
printf "${STY_RST}"
|
printf "${STY_RST}"
|
||||||
}
|
}
|
||||||
function pause(){
|
function pause(){
|
||||||
@@ -73,8 +73,7 @@ function pause(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function remove_bashcomments_emptylines(){
|
function remove_bashcomments_emptylines(){
|
||||||
mkdir -p $(dirname $2)
|
mkdir -p "$(dirname "$2")" && cat "$1" | sed -e 's/#.*//' -e '/^[[:space:]]*$/d' > "$2"
|
||||||
cat $1 | sed -e '/^[[:blank:]]*#/d;s/#.*//' -e '/^[[:space:]]*$/d' > $2
|
|
||||||
}
|
}
|
||||||
function prevent_sudo_or_root(){
|
function prevent_sudo_or_root(){
|
||||||
case $(whoami) in
|
case $(whoami) in
|
||||||
@@ -95,7 +94,7 @@ function latest_commit_timestamp(){
|
|||||||
echo "[latest_commit_timestamp] The timestamp of \"$target_path\" is empty. Aborting..." >&2
|
echo "[latest_commit_timestamp] The timestamp of \"$target_path\" is empty. Aborting..." >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo $result
|
echo "$result"
|
||||||
}
|
}
|
||||||
|
|
||||||
function log_info() {
|
function log_info() {
|
||||||
|
|||||||
@@ -157,7 +157,11 @@ VERBOSE=false
|
|||||||
NON_INTERACTIVE=true
|
NON_INTERACTIVE=true
|
||||||
|
|
||||||
source "$ORIGINAL_DIR/sdata/step/exp-update.sh"
|
source "$ORIGINAL_DIR/sdata/step/exp-update.sh"
|
||||||
detect_repo_structure
|
detected_dirs=$(detect_repo_structure)
|
||||||
|
if [[ -n "$detected_dirs" ]]; then
|
||||||
|
read -ra MONITOR_DIRS <<<"$detected_dirs"
|
||||||
|
fi
|
||||||
|
echo "Structure: ${MONITOR_DIRS[*]}"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x test_detection.sh
|
chmod +x test_detection.sh
|
||||||
@@ -212,7 +216,11 @@ VERBOSE=false
|
|||||||
NON_INTERACTIVE=true
|
NON_INTERACTIVE=true
|
||||||
|
|
||||||
source "$ORIGINAL_DIR/sdata/step/exp-update.sh"
|
source "$ORIGINAL_DIR/sdata/step/exp-update.sh"
|
||||||
detect_repo_structure
|
detected_dirs=$(detect_repo_structure)
|
||||||
|
if [[ -n "$detected_dirs" ]]; then
|
||||||
|
read -ra MONITOR_DIRS <<<"$detected_dirs"
|
||||||
|
fi
|
||||||
|
echo "Structure: ${MONITOR_DIRS[*]}"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x test_detection.sh
|
chmod +x test_detection.sh
|
||||||
@@ -507,7 +515,7 @@ test_lock_file() {
|
|||||||
echo "99999" > .update-lock
|
echo "99999" > .update-lock
|
||||||
|
|
||||||
# Try to run update - should fail due to lock
|
# Try to run update - should fail due to lock
|
||||||
if ./install.sh exp-update --skip-notice --non-interactive --dry-run 2>&1 | grep -q "stale lock"; then
|
if ./install.sh exp-update --skip-notice --non-interactive 2>&1 | grep -q "stale lock"; then
|
||||||
log_pass "Lock file mechanism works (detected stale lock)"
|
log_pass "Lock file mechanism works (detected stale lock)"
|
||||||
cd "$ORIGINAL_DIR"
|
cd "$ORIGINAL_DIR"
|
||||||
return 0
|
return 0
|
||||||
@@ -780,7 +788,6 @@ main() {
|
|||||||
"test_flags"
|
"test_flags"
|
||||||
"test_shellcheck"
|
"test_shellcheck"
|
||||||
"test_lock_file"
|
"test_lock_file"
|
||||||
"test_ignore_pattern_caching"
|
|
||||||
"test_directory_caching"
|
"test_directory_caching"
|
||||||
"test_safe_read_noninteractive"
|
"test_safe_read_noninteractive"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -49,9 +49,6 @@ declare -A CREATED_DIRS
|
|||||||
# TODO: Is this really needed? `git pull` should do a full upgrade, not partially, which means this script will be updated along with the folder structure together.
|
# TODO: Is this really needed? `git pull` should do a full upgrade, not partially, which means this script will be updated along with the folder structure together.
|
||||||
# Auto-detect repository structure
|
# Auto-detect repository structure
|
||||||
detect_repo_structure() {
|
detect_repo_structure() {
|
||||||
if which pacman &>/dev/null; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
local found_dirs=()
|
local found_dirs=()
|
||||||
|
|
||||||
# Check for dots/ prefixed structure
|
# Check for dots/ prefixed structure
|
||||||
@@ -164,7 +161,9 @@ load_ignore_patterns() {
|
|||||||
|
|
||||||
# Separate substring patterns from regular patterns
|
# Separate substring patterns from regular patterns
|
||||||
if [[ "$pattern" == \*\** ]]; then
|
if [[ "$pattern" == \*\** ]]; then
|
||||||
IGNORE_SUBSTRING_PATTERNS+=("${pattern#\*\*}")
|
local cleaned_pattern="${pattern#\*\*}"
|
||||||
|
cleaned_pattern="${cleaned_pattern%%*}"
|
||||||
|
IGNORE_SUBSTRING_PATTERNS+=("$cleaned_pattern")
|
||||||
else
|
else
|
||||||
IGNORE_PATTERNS+=("$pattern")
|
IGNORE_PATTERNS+=("$pattern")
|
||||||
fi
|
fi
|
||||||
@@ -720,7 +719,7 @@ cleanup_on_exit() {
|
|||||||
trap cleanup_on_exit EXIT INT TERM
|
trap cleanup_on_exit EXIT INT TERM
|
||||||
|
|
||||||
# Check for concurrent runs
|
# Check for concurrent runs
|
||||||
if [[ -f "${REPO_ROOT}/.update-lock" ]] && [[ "$DRY_RUN" != true ]]; then
|
if [[ -f "${REPO_ROOT}/.update-lock" ]]; then
|
||||||
# Check if the process is still running
|
# Check if the process is still running
|
||||||
if kill -0 $(cat "${REPO_ROOT}/.update-lock" 2>/dev/null) 2>/dev/null; then
|
if kill -0 $(cat "${REPO_ROOT}/.update-lock" 2>/dev/null) 2>/dev/null; then
|
||||||
log_die "Another update is already running (PID: $(cat "${REPO_ROOT}/.update-lock"))"
|
log_die "Another update is already running (PID: $(cat "${REPO_ROOT}/.update-lock"))"
|
||||||
@@ -963,8 +962,8 @@ elif has_new_commits; then
|
|||||||
process_files=true
|
process_files=true
|
||||||
log_info "New commits detected: checking changed configuration files"
|
log_info "New commits detected: checking changed configuration files"
|
||||||
else
|
else
|
||||||
log_info "No new commits found: checking for local file differences"
|
log_info "No new commits found and force mode not enabled: skipping file updates"
|
||||||
process_files=true
|
process_files=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$process_files" == true ]]; then
|
if [[ "$process_files" == true ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user