commit 9268792d46c00c9dd6d89e90d783756a74db1fbe Author: OPPEN321 Date: Tue Sep 23 12:14:03 2025 +0800 Create build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..99b8d1d --- /dev/null +++ b/build.sh @@ -0,0 +1,72 @@ +#!/bin/bash -e +export RED_COLOR='\e[1;31m' +export GREEN_COLOR='\e[1;32m' +export YELLOW_COLOR='\e[1;33m' +export BLUE_COLOR='\e[1;34m' +export PINK_COLOR='\e[1;35m' +export SHAN='\e[1;33;5m' +export RES='\e[0m' + +GROUP= +group() { + endgroup + echo "::group:: $1" + GROUP=1 +} +endgroup() { + if [ -n "$GROUP" ]; then + echo "::endgroup::" + fi + GROUP= +} + +# 查看 +if [ "$(whoami)" != "zhao" ] && [ -z "$git_name" ] && [ -z "$git_password" ]; then + echo -e "\n${RED_COLOR} Not authorized. Execute the following command to provide authorization information:${RES}\n" + echo -e "${BLUE_COLOR} export git_name=your_username git_password=your_password${RES}\n" + exit 1 +fi + +# 打印头部 +echo -e "" +echo -e "${BLUE_COLOR}╔═════════════════════════════════════════════════════════════╗${RES}" +echo -e "${BLUE_COLOR}║${RES} OPENWRT BUILD SYSTEM ${BLUE_COLOR}║${RES}" +echo -e "${BLUE_COLOR}╚═════════════════════════════════════════════════════════════╝${RES}" +echo -e "${BLUE_COLOR}┌─────────────────────────────────────────────────────────────┐${RES}" +echo -e "${BLUE_COLOR}│${RES} 🛠️ ${YELLOW_COLOR}Developer:${RES} OPPEN321 ${BLUE_COLOR}│${RES}" +echo -e "${BLUE_COLOR}│${RES} 🌐 ${YELLOW_COLOR}Blog:${RES} www.kejizero.online ${BLUE_COLOR}│${RES}" +echo -e "${BLUE_COLOR}│${RES} 💡 ${YELLOW_COLOR}Philosophy:${RES} Open Source · Customization · Performance ${BLUE_COLOR}│${RES}" +echo -e "${BLUE_COLOR}└─────────────────────────────────────────────────────────────┘${RES}" +echo -e "${BLUE_COLOR}🔧 ${GREEN_COLOR}Building:${RES} $(date '+%Y-%m-%d %H:%M:%S')" +echo -e "${BLUE_COLOR}══════════════════════════════════════════════════════════════${RES}" +echo -e "" + +# 检测 Root +if [ "$(id -u)" = "0" ]; then + export FORCE_UNSAFE_CONFIGURE=1 FORCE=1 +fi + +# 开始时间 +starttime=`date +'%Y-%m-%d %H:%M:%S'` +CURRENT_DATE=$(date +%s) + +# 处理器核心数设置 +cores=`expr $(nproc --all) + 1` + +# 进度条设置 +if curl --help | grep progress-bar >/dev/null 2>&1; then + CURL_BAR="--progress-bar"; +fi + +SUPPORTED_BOARDS="rockchip x86_64" +if [ -z "$1" ] || ! echo "$SUPPORTED_BOARDS" | grep -qw "$2"; then + echo -e "\n${RED_COLOR}Building type not specified or unsupported board: '$2'.${RES}\n" + echo -e "Usage:\n" + + for board in $SUPPORTED_BOARDS; do + echo -e "$board releases: ${GREEN_COLOR}bash build.sh v24 $board${RES}" + done + echo + exit 1 +fi +