Tool checking optimization
This commit is contained in:
parent
6e2d40fc18
commit
3b77a2cefa
10 changed files with 78 additions and 121 deletions
|
|
@ -14,19 +14,14 @@ project_root="$1"
|
|||
fswebcam_package="$2"
|
||||
|
||||
# check the required tools
|
||||
TOOL_LIST=("unzip")
|
||||
i=0
|
||||
part_num=${#TOOL_LIST[*]}
|
||||
while [ $i -lt $((part_num)) ]; do
|
||||
echo "Checking tool: ${TOOL_LIST[$i]}"
|
||||
t=$(which "${TOOL_LIST[$i]}")
|
||||
if [ -z "$t" ]; then
|
||||
if [ ! -f "TOOLS/${TOOL_LIST[$i]}" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '${TOOL_LIST[$i]}' ${NC}"
|
||||
exit 2
|
||||
fi
|
||||
TOOL_LIST="unzip"
|
||||
for tool_name in $TOOL_LIST; do
|
||||
echo "Checking tool: $tool_name"
|
||||
tool_path=$(which "$tool_name")
|
||||
if [ -z "$tool_path" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
|
||||
exit 1
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
# check the project root folder
|
||||
|
|
|
|||
|
|
@ -14,19 +14,14 @@ project_root="$1"
|
|||
opkg_package="$2"
|
||||
|
||||
# check the required tools
|
||||
TOOL_LIST=("unzip")
|
||||
i=0
|
||||
part_num=${#TOOL_LIST[*]}
|
||||
while [ $i -lt $((part_num)) ]; do
|
||||
echo "Checking tool: ${TOOL_LIST[$i]}"
|
||||
t=$(which "${TOOL_LIST[$i]}")
|
||||
if [ -z "$t" ]; then
|
||||
if [ ! -f "TOOLS/${TOOL_LIST[$i]}" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '${TOOL_LIST[$i]}' ${NC}"
|
||||
exit 2
|
||||
fi
|
||||
TOOL_LIST="unzip"
|
||||
for tool_name in $TOOL_LIST; do
|
||||
echo "Checking tool: $tool_name"
|
||||
tool_path=$(which "$tool_name")
|
||||
if [ -z "$tool_path" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
|
||||
exit 1
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
# check the project root folder
|
||||
|
|
|
|||
|
|
@ -14,19 +14,14 @@ project_root="$1"
|
|||
python_package="$2"
|
||||
|
||||
# check the required tools
|
||||
TOOL_LIST=("unzip")
|
||||
i=0
|
||||
part_num=${#TOOL_LIST[*]}
|
||||
while [ $i -lt $((part_num)) ]; do
|
||||
echo "Checking tool: ${TOOL_LIST[$i]}"
|
||||
t=$(which "${TOOL_LIST[$i]}")
|
||||
if [ -z "$t" ]; then
|
||||
if [ ! -f "$project_root/TOOLS/${TOOL_LIST[$i]}" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '${TOOL_LIST[$i]}' ${NC}"
|
||||
exit 2
|
||||
fi
|
||||
TOOL_LIST="unzip"
|
||||
for tool_name in $TOOL_LIST; do
|
||||
echo "Checking tool: $tool_name"
|
||||
tool_path=$(which "$tool_name")
|
||||
if [ -z "$tool_path" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
|
||||
exit 1
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
# check the project root folder
|
||||
|
|
|
|||
|
|
@ -14,19 +14,14 @@ project_root="$1"
|
|||
ssh_package="$2"
|
||||
|
||||
# check the required tools
|
||||
TOOL_LIST=("unzip")
|
||||
i=0
|
||||
part_num=${#TOOL_LIST[*]}
|
||||
while [ $i -lt $((part_num)) ]; do
|
||||
echo "Checking tool: ${TOOL_LIST[$i]}"
|
||||
t=$(which "${TOOL_LIST[$i]}")
|
||||
if [ -z "$t" ]; then
|
||||
if [ ! -f "TOOLS/${TOOL_LIST[$i]}" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '${TOOL_LIST[$i]}' ${NC}"
|
||||
exit 2
|
||||
fi
|
||||
TOOL_LIST="unzip"
|
||||
for tool_name in $TOOL_LIST; do
|
||||
echo "Checking tool: $tool_name"
|
||||
tool_path=$(which "$tool_name")
|
||||
if [ -z "$tool_path" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
|
||||
exit 1
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
# check the project root folder
|
||||
|
|
|
|||
|
|
@ -14,19 +14,14 @@ project_root="$1"
|
|||
uart_package="$2"
|
||||
|
||||
# check the required tools
|
||||
TOOL_LIST=("unzip")
|
||||
i=0
|
||||
part_num=${#TOOL_LIST[*]}
|
||||
while [ $i -lt $((part_num)) ]; do
|
||||
echo "Checking tool: ${TOOL_LIST[$i]}"
|
||||
t=$(which "${TOOL_LIST[$i]}")
|
||||
if [ -z "$t" ]; then
|
||||
if [ ! -f "TOOLS/${TOOL_LIST[$i]}" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '${TOOL_LIST[$i]}' ${NC}"
|
||||
exit 2
|
||||
fi
|
||||
TOOL_LIST="unzip"
|
||||
for tool_name in $TOOL_LIST; do
|
||||
echo "Checking tool: $tool_name"
|
||||
tool_path=$(which "$tool_name")
|
||||
if [ -z "$tool_path" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
|
||||
exit 1
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
# check the project root folder
|
||||
|
|
|
|||
|
|
@ -16,28 +16,24 @@ webcam_package="$2"
|
|||
# check the required tools
|
||||
app_version_tool=$(which app_version.sh)
|
||||
app_model_tool=$(which app_model.sh)
|
||||
TOOL_LIST=("unzip" "app_version.sh" "app_model.sh")
|
||||
i=0
|
||||
part_num=${#TOOL_LIST[*]}
|
||||
while [ $i -lt $((part_num)) ]; do
|
||||
toolname=${TOOL_LIST[$i]}
|
||||
echo "Checking tool: $toolname"
|
||||
tpath=$(which "$toolname")
|
||||
if [ -z "$tpath" ]; then
|
||||
local_tool_path="$project_root/TOOLS/$toolname"
|
||||
TOOL_LIST="unzip app_version.sh app_model.sh"
|
||||
for tool_name in $TOOL_LIST; do
|
||||
echo "Checking tool: $tool_name"
|
||||
tool_path=$(which "$tool_name")
|
||||
if [ -z "$tool_path" ]; then
|
||||
local_tool_path="$project_root/TOOLS/$tool_name"
|
||||
if [ ! -f "$local_tool_path" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '$toolname' ${NC}"
|
||||
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
|
||||
exit 2
|
||||
else
|
||||
if [ "$toolname" == "app_version.sh" ]; then
|
||||
if [ "$tool_name" == "app_version.sh" ]; then
|
||||
app_version_tool="$local_tool_path"
|
||||
fi
|
||||
if [ "$toolname" == "app_model.sh" ]; then
|
||||
if [ "$tool_name" == "app_model.sh" ]; then
|
||||
app_model_tool="$local_tool_path"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
# check the project root folder
|
||||
|
|
@ -95,23 +91,23 @@ if [ "$app_ver" == "3.0.9" ]; then
|
|||
sed -i 's/video4linux/videoXlinux/g' "$def_target"
|
||||
if [ "$app_model" == "K2Pro" ]; then
|
||||
# stop the app to log the message 'cannot open video'
|
||||
printf "\x00\xf0\x20\xe3" | dd of="$def_target" bs=1 seek=2339112 conv=notrunc &>>/dev/null
|
||||
printf "\x00\xf0\x20\xe3" | dd of="$def_target" bs=1 seek=2339112 conv=notrunc
|
||||
# slow captive portal commmunication
|
||||
printf "\xff\x8f\x0f\xe3" | dd of="$def_target" bs=1 seek=63492 conv=notrunc &>>/dev/null
|
||||
printf "\xff\x8f\x0f\xe3" | dd of="$def_target" bs=1 seek=63492 conv=notrunc
|
||||
exit 0
|
||||
fi
|
||||
if [ "$app_model" == "K2Plus" ]; then
|
||||
# stop the app to log the message 'cannot open video'
|
||||
printf "\x00\xf0\x20\xe3" | dd of="$def_target" bs=1 seek=2339152 conv=notrunc &>>/dev/null
|
||||
printf "\x00\xf0\x20\xe3" | dd of="$def_target" bs=1 seek=2339152 conv=notrunc
|
||||
# slow captive portal commmunication
|
||||
printf "\xff\x8f\x0f\xe3" | dd of="$def_target" bs=1 seek=63492 conv=notrunc &>>/dev/null
|
||||
printf "\xff\x8f\x0f\xe3" | dd of="$def_target" bs=1 seek=63492 conv=notrunc
|
||||
exit 0
|
||||
fi
|
||||
if [ "$app_model" == "K2Max" ]; then
|
||||
# stop the app to log the message 'cannot open video'
|
||||
printf "\x00\xf0\x20\xe3" | dd of="$def_target" bs=1 seek=2339152 conv=notrunc &>>/dev/null
|
||||
printf "\x00\xf0\x20\xe3" | dd of="$def_target" bs=1 seek=2339152 conv=notrunc
|
||||
# slow captive portal commmunication
|
||||
printf "\xff\x8f\x0f\xe3" | dd of="$def_target" bs=1 seek=63492 conv=notrunc &>>/dev/null
|
||||
printf "\xff\x8f\x0f\xe3" | dd of="$def_target" bs=1 seek=63492 conv=notrunc
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
19
fwdl.sh
19
fwdl.sh
|
|
@ -22,19 +22,16 @@ if [ "$par_model" != "K2Pro" ] && [ "$par_model" != "K2Plus" ] && [ "$par_model"
|
|||
fi
|
||||
|
||||
# check the required tools
|
||||
TOOL_LIST=("curl" "wc" "awk")
|
||||
i=0
|
||||
part_num=${#TOOL_LIST[*]}
|
||||
while [ $i -lt $((part_num)) ]; do
|
||||
echo "Checking tool: ${TOOL_LIST[$i]}"
|
||||
t=$(which "${TOOL_LIST[$i]}")
|
||||
if [ -z "$t" ]; then
|
||||
if [ ! -f "TOOLS/${TOOL_LIST[$i]}" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '${TOOL_LIST[$i]}' ${NC}"
|
||||
exit 2
|
||||
TOOL_LIST="curl wc awk"
|
||||
for tool_name in $TOOL_LIST; do
|
||||
echo "Checking tool: $tool_name"
|
||||
tool_path=$(which "$tool_name")
|
||||
if [ -z "$tool_path" ]; then
|
||||
if [ ! -f "TOOLS/$tool_name" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
url_bin="https://cdn.cloud-universe.anycubic.com/ota/${par_model}/AC104_${par_model}_1.1.0_${par_version}_update.bin"
|
||||
|
|
|
|||
15
pack.sh
15
pack.sh
|
|
@ -9,17 +9,14 @@ NC='\033[0m'
|
|||
FILES="sw-description sw-description.sig boot-resource uboot boot0 kernel rootfs dsp0 cpio_item_md5"
|
||||
|
||||
# check the required tools
|
||||
TOOL_LIST=("md5sum" "openssl" "sha256sum" "mksquashfs")
|
||||
i=0
|
||||
part_num=${#TOOL_LIST[*]}
|
||||
while [ $i -lt $((part_num)) ]; do
|
||||
echo "Checking tool: ${TOOL_LIST[$i]}"
|
||||
t=$(which "${TOOL_LIST[$i]}")
|
||||
if [ -z "$t" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '${TOOL_LIST[$i]}' ${NC}"
|
||||
TOOL_LIST="md5sum openssl sha256sum mksquashfs"
|
||||
for tool_name in $TOOL_LIST; do
|
||||
echo "Checking tool: $tool_name"
|
||||
tool_path=$(which "$tool_name")
|
||||
if [ -z "$tool_path" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
|
||||
exit 1
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
# remove the last created update
|
||||
|
|
|
|||
19
patch.sh
19
patch.sh
|
|
@ -27,19 +27,14 @@ if [ ! -f "$optionsfile" ]; then
|
|||
fi
|
||||
|
||||
# check the required tools
|
||||
TOOL_LIST=("awk")
|
||||
i=0
|
||||
part_num=${#TOOL_LIST[*]}
|
||||
while [ $i -lt $((part_num)) ]; do
|
||||
echo "Checking tool: ${TOOL_LIST[$i]}"
|
||||
t=$(which "${TOOL_LIST[$i]}")
|
||||
if [ -z "$t" ]; then
|
||||
if [ ! -f "TOOLS/${TOOL_LIST[$i]}" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '${TOOL_LIST[$i]}' ${NC}"
|
||||
exit 2
|
||||
fi
|
||||
TOOL_LIST="awk"
|
||||
for tool_name in $TOOL_LIST; do
|
||||
echo "Checking tool: $tool_name"
|
||||
tool_path=$(which "$tool_name")
|
||||
if [ -z "$tool_path" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
|
||||
exit 1
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
# remove the old result file for the installed options
|
||||
|
|
|
|||
17
unpack.sh
17
unpack.sh
|
|
@ -29,19 +29,16 @@ if [ "$UPDATE_FILE_EXT" != "bin" ] && [ "$UPDATE_FILE_EXT" != "swu" ] && [ "$UPD
|
|||
fi
|
||||
|
||||
# check the required tools
|
||||
TOOL_LIST=("cpio" "unsquashfs" "unzip" "ack2_swu_decrypt.py" "python3")
|
||||
i=0
|
||||
part_num=${#TOOL_LIST[*]}
|
||||
while [ $i -lt $((part_num)) ]; do
|
||||
echo "Checking tool: ${TOOL_LIST[$i]}"
|
||||
t=$(which "${TOOL_LIST[$i]}")
|
||||
if [ -z "$t" ]; then
|
||||
if [ ! -f "TOOLS/${TOOL_LIST[$i]}" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '${TOOL_LIST[$i]}' ${NC}"
|
||||
TOOL_LIST="cpio unsquashfs unzip ack2_swu_decrypt.py python3"
|
||||
for tool_name in $TOOL_LIST; do
|
||||
echo "Checking tool: $tool_name"
|
||||
tool_path=$(which "$tool_name")
|
||||
if [ -z "$tool_path" ]; then
|
||||
if [ ! -f "TOOLS/$tool_name" ]; then
|
||||
echo -e "${RED}ERROR: Missing tool '$tool_name' ${NC}"
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
i=$(($i + 1))
|
||||
done
|
||||
|
||||
# set the custom decrypt tool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue