@@ -149,7 +149,7 @@ validate_directory() {
149149
150150 if [ -n " $dir " ]; then
151151 if [[ " $dir " =~ ^- ]]; then
152- echo " Error: $type directory parameter '$dir ' cannot start with '-'" >&2
152+ log_fail " Error: $type directory parameter '$dir ' cannot start with '-'"
153153 exit 1
154154 fi
155155 fi
@@ -288,14 +288,20 @@ create_debian_folder() {
288288 debian:13)
289289 control_source=" $repo_root /Package/debian/control.debian.13"
290290 ;;
291+ deepin* )
292+ control_source=" $repo_root /Package/debian/control.deepin.23"
293+ ;;
291294 * )
292295 control_source=" $repo_root /Package/debian/control.default"
293296 ;;
294297 esac
295298 if [ -f " $control_source " ]; then
296299 ln -s $control_source $repo_root /debian/control
300+ if [ " $BUILD_VERBOSE " = " ON" ]; then
301+ echo " ln -s $control_source $repo_root /debian/control"
302+ fi
297303 else
298- echo " Error: $control_source is not exist"
304+ log_fail " Error: $control_source is not exist"
299305 fi
300306 fi
301307
@@ -320,7 +326,7 @@ install_debian_depend() {
320326# grep -v '^$' | \
321327# xargs sudo apt install -y
322328 else
323- echo " Error: $repo_root /debian/control is not exist"
329+ log_fail " Error: $repo_root /debian/control is not exist"
324330 fi
325331}
326332
@@ -450,17 +456,17 @@ detect_os_info() {
450456# export ARCHITECTURE=$(echo "$system_info" | grep "^Architecture:" | awk -F': ' '{print $2}')
451457
452458 # 如果是 macOS,进行初始化设置
453- if [ " $OS " = " macOS" ]; then
459+ if [ " $DISTRO " = " macOS" ]; then
454460 setup_macos
455461 fi
456462
457463 if [ " $BUILD_VERBOSE " = " ON" ]; then
458464 echo " === OS information (detect_os_info) ==="
459- echo " Detected OS: $OS "
460- echo " Distribution: $DISTRO "
461- echo " Version: $DISTRO_VERSION "
462- echo " Package tool: $PACKAGE_TOOL "
463- echo " Architecture: $ARCHITECTURE "
465+ echo " Detected OS[OS]: $OS "
466+ echo " Distribution[DISTRO]: $DISTRO "
467+ echo " Version[DISTRO_VERSION]: $DISTRO_VERSION "
468+ echo " Package tool[PACKAGE_TOOL] : $PACKAGE_TOOL "
469+ echo " Architecture[ARCHITECTURE] : $ARCHITECTURE "
464470 echo " ======================================="
465471 echo " PATH: $PATH "
466472 fi
@@ -495,7 +501,7 @@ version_compare() {
495501# Function to check if git is installed
496502check_git () {
497503 if ! command -v git > /dev/null 2>&1 ; then
498- echo " X Git is not installed" >&2
504+ echo_error " X Git is not installed" >&2
499505 echo " Git is required for this script to work." >&2
500506 echo " " >&2
501507 echo " Please install Git using one of the following commands:" >&2
@@ -528,10 +534,10 @@ check_git() {
528534 local git_version=$( git --version | cut -d' ' -f3)
529535
530536 if ! version_compare " $git_version " " $min_version " ; then
531- echo " !️ Git version $git_version is installed, but version $min_version or higher is recommended" >&2
537+ echo_warn " !️ Git version $git_version is installed, but version $min_version or higher is recommended" >&2
532538 # Continue anyway, just a warning
533539 else
534- echo " √ Git $git_version is installed"
540+ echo_success " √ Git $git_version is installed"
535541 fi
536542 fi
537543
@@ -541,7 +547,7 @@ check_git() {
541547# Option to automatically install git (with user confirmation)
542548install_git_if_missing () {
543549 if ! command -v git > /dev/null 2>&1 ; then
544- echo " !️ Git is required but not installed." >&2
550+ echo_warn " !️ Git is required but not installed." >&2
545551 read -p " Would you like to install Git now? (y/n): " -n 1 -r
546552 echo
547553 if [[ $REPLY =~ ^[Yy]$ ]]; then
@@ -558,23 +564,23 @@ install_git_if_missing() {
558564 if command -v brew > /dev/null 2>&1 ; then
559565 brew install git
560566 else
561- echo " X Homebrew not found. Please install Git manually from https://git-scm.com/download/mac" >&2
567+ echo_error " X Homebrew not found. Please install Git manually from https://git-scm.com/download/mac" >&2
562568 return 1
563569 fi
564570 else
565- echo " X Unsupported OS. Please install Git manually." >&2
571+ echo_error " X Unsupported OS. Please install Git manually." >&2
566572 return 1
567573 fi
568574
569575 # Verify installation
570576 if command -v git > /dev/null 2>&1 ; then
571- echo " √ Git installed successfully!"
577+ echo_success " √ Git installed successfully!"
572578 else
573- echo " X Git installation failed. Please install manually." >&2
579+ echo_error " X Git installation failed. Please install manually." >&2
574580 return 1
575581 fi
576582 else
577- echo " X Git is required. Exiting." >&2
583+ echo_error " X Git is required. Exiting." >&2
578584 return 1
579585 fi
580586 fi
@@ -597,17 +603,17 @@ test_sed_pattern() {
597603
598604 # Test with -E flag
599605 if echo " $test_string " | sed -E " s/${VERSION_PATTERN} /REPLACED/g" | grep -q " REPLACED" ; then
600- echo " √ -E flag: Matches"
606+ echo_success " √ -E flag: Matches"
601607 else
602- echo " X -E flag: No match"
608+ echo_error " X -E flag: No match"
603609 fi
604610
605611 # Convert to BRE and test
606612 BRE_PATTERN=$( sed_safe_pattern " $VERSION_PATTERN " )
607613 if echo " $test_string " | sed " s/${BRE_PATTERN} /REPLACED/g" | grep -q " REPLACED" ; then
608- echo " √ BRE: Matches"
614+ echo_success " √ BRE: Matches"
609615 else
610- echo " X BRE: No match"
616+ echo_error " X BRE: No match"
611617 fi
612618}
613619
@@ -656,14 +662,14 @@ version_parser() {
656662 return 0
657663 fi
658664
659- echo " ERROR: Unable to parse version number '$version '" >&2
665+ log_fail " ERROR: Unable to parse version number '$version '" >&2
660666 return 1
661667}
662668
663669# 辅助函数:显示版本数组
664670display_version_info () {
665671 local -a data=($@ )
666-
672+
667673 if [[ ${# data[@]} -ge 8 ]]; then
668674 cat << EOF
669675版本信息:
@@ -677,7 +683,7 @@ display_version_info() {
677683 是否包含构建: ${data[7]}
678684EOF
679685 else
680- echo " 数据不完整"
686+ log_fail " 数据不完整"
681687 fi
682688}
683689
@@ -702,7 +708,7 @@ parse_version_assoc() {
702708 version_array[build]=" ${BASH_REMATCH[10]:- } "
703709 return 0
704710 else
705- echo " ERROR: Unable to parse version number '$version '" >&2
711+ log_fail " ERROR: Unable to parse version number '$version '" >&2
706712 return 1
707713 fi
708714}
@@ -772,7 +778,7 @@ compare_versions() {
772778
773779 # 检查数组元素个数
774780 if [ ${# parts1[@]} -lt 3 ] || [ ${# parts2[@]} -lt 3 ]; then
775- echo " version format error" >&2
781+ log_fail " version format error" >&2
776782 return 3
777783 fi
778784
0 commit comments