-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
82 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,90 @@ | ||
#!/bin/bash | ||
# 编译op前准备 | ||
echo "Running update and install feed..." | ||
# update | ||
./scripts/feeds update -a | ||
./scripts/feeds install -a | ||
|
||
|
||
if [[ $1 == "-y" ]]; then | ||
# 自动执行 | ||
echo "make defconfig" | ||
make defconfig | ||
echo "make download -j8" | ||
make download -j8 | ||
else | ||
# 手动询问是否执行update2 | ||
read -n 1 -r -p "make defconfig now? (y/n) " answer | ||
echo | ||
if [[ $answer == [Yy] ]]; then | ||
|
||
# 更新feeds文件 | ||
function update_feeds() { | ||
echo "Running update and install feed..." | ||
./scripts/feeds update -a | ||
./scripts/feeds install -a | ||
} | ||
|
||
# 执行make defconfig | ||
function make_defconfig() { | ||
echo "make defconfig" | ||
make defconfig | ||
fi | ||
} | ||
|
||
# 手动询问是否执行update3 | ||
read -n 1 -r -p "make download -j8 now? (y/n) " answer | ||
echo | ||
if [[ $answer == [Yy] ]]; then | ||
function make_download() { | ||
echo "make download -j8" | ||
make download -j8 | ||
fi | ||
} | ||
# 根据参数执行相应操作 | ||
# 1. -u|--update 更新feeds文件 | ||
# 2. -d|--defconfig 执行make defconfig | ||
# 3. -m|--download 执行make download -j8 | ||
# shift 命令用于对参数的移动(左移) | ||
all=false | ||
update=false | ||
defconfig=false | ||
download=false | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
-u|--update) | ||
update=true | ||
shift | ||
;; | ||
-d|--defconfig) | ||
defconfig=true | ||
shift | ||
;; | ||
-m|--download) | ||
download=true | ||
shift | ||
;; | ||
-a) | ||
all=true | ||
shift | ||
;; | ||
*) | ||
echo "无效的选项: $1" | ||
shift | ||
;; | ||
esac | ||
done | ||
|
||
if $all || $update; then | ||
update_feeds | ||
fi | ||
|
||
if $all || $defconfig; then | ||
make_defconfig | ||
fi | ||
|
||
if $all || $download; then | ||
make_download | ||
fi | ||
|
||
# if [[ $1 == "-y" ]]; then | ||
# # 自动执行 | ||
# echo "make defconfig" | ||
# make defconfig | ||
# echo "make download -j8" | ||
# make download -j8 | ||
# else | ||
# # 手动询问是否执行update2 | ||
# read -n 1 -r -p "make defconfig now? (y/n) " answer | ||
# echo | ||
# if [[ $answer == [Yy] ]]; then | ||
# echo "make defconfig" | ||
# make defconfig | ||
# fi | ||
|
||
# # 手动询问是否执行update3 | ||
# read -n 1 -r -p "make download -j8 now? (y/n) " answer | ||
# echo | ||
# if [[ $answer == [Yy] ]]; then | ||
# echo "make download -j8" | ||
# make download -j8 | ||
# fi | ||
# fi |