From 17dc5d5ae811784a5c848f3a05493792bba74b8a Mon Sep 17 00:00:00 2001 From: Yinan Qin <39023210+ganyuanzhen@users.noreply.github.com> Date: Thu, 7 Mar 2024 10:17:11 +0800 Subject: [PATCH] Update build-github.sh --- build-github.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/build-github.sh b/build-github.sh index ffdf5a5..d5ac78b 100755 --- a/build-github.sh +++ b/build-github.sh @@ -1,25 +1,35 @@ #!/bin/bash set -e +script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) +source_dir=$source_dir echo '欢迎使用灵墨OS自动编译脚本!' echo '提示: 使用前请确认已经安装了所有必要的依赖。' -if test -e ~/LingmoOS +if test -e $source_dir then echo '存在同名的LingmoOS文件夹,正在删除...' - rm -rf ~/LingmoOS + rm -rf $source_dir fi echo '创建新的LingmoOS文件夹...' -mkdir ~/LingmoOS +mkdir $source_dir + +function InstallDepends() { + echo '开始安装依赖' + apt install git devscripts equivs + git clone https://github.com/LingmoOS/LingmoOSBuildDeps.git + cd LingmoOSBuildDeps + mk-build-deps -i -t "apt-get -y" -r +} # 定义一个函数来编译项目 function Compile() { repo_name=$1 echo "开始编译 $repo_name ..." - cd ~/LingmoOS + cd $source_dir if test -d $repo_name; then echo "已存在 $repo_name 目录,更新中..." - cd $repo_name && git pull + cd $repo_name && git reset --hard HEAD && git pull else echo "正在克隆 $repo_name ..." git clone https://github.com/LingmoOS/$repo_name.git @@ -33,13 +43,6 @@ function Compile() { # 在这里添加项目构建和编译命令 echo "$repo_name 编译完成" } - -echo '开始安装依赖' -apt install git devscripts equivs -git clone https://github.com/LingmoOS/LingmoOSBuildDeps.git -cd LingmoOSBuildDeps -mk-build-deps -i -t "apt-get -y" -r - REPOS="lingmo-screenlocker lingmo-settings lingmo-screenshots lingmo-cursor-themes lingmo-sddm-theme lingmo-appmotor lingmo-neofetch lingmo-daemon lingmo-ocr lingmo-terminal lingmo-gtk-themes LingmoUI lingmo-systemicons lingmo-wallpapers lingmo-debinstaller lingmo-calculator lingmo-system-build lingmo-windows-plugins lingmo-launcher lingmo-kwin lingmo-kernel lingmo-statusbar lingmo-qt-plugins lingmo-dock lingmo-system-core liblingmo lingmo-filemanager lingmo-core lingmo-texteditor lingmo-kwin-plugins lingmo-videoplayer" # 列出所有项目供用户选择 @@ -79,6 +82,7 @@ all \ quit do + InstallDepends if [[ $project == "all" ]]; then for repo in $REPOS; do Compile $repo