add more options
This commit is contained in:
parent
80c0866757
commit
a43cdacb7e
19 changed files with 189 additions and 3 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -49,7 +51,8 @@ dns_url="udp://$old_dns:53"
|
|||
results=$(grep --binary-files=text -b -o "$dns_url" "$def_target" | xargs echo -n)
|
||||
if [ -z "$results" ]; then
|
||||
echo -e "${RED}ERROR: The 'app' might be already patched. Cannot find the expected DNS '$dns_url' ${NC}"
|
||||
exit 5
|
||||
echo -e "${YELLOW}INFO: Will not patch the 'app' file...${NC}"
|
||||
exit 0
|
||||
fi
|
||||
# replace all found old DNS with the new one
|
||||
for result in $results; do
|
||||
|
|
@ -57,4 +60,6 @@ for result in $results; do
|
|||
printf "udp://%s:53\x00" "$new_dns" | dd of="$def_target" bs=1 seek="$offset" conv=notrunc &>>/dev/null
|
||||
done
|
||||
|
||||
echo -e "${GREEN}SUCCESS: The 'app' has been patched with the new DNS '$new_dns' ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -36,4 +37,6 @@ fi
|
|||
# copy the selected image set to the target
|
||||
/bin/cp -rf "$image_set_folder" "$target_folder"
|
||||
|
||||
echo -e "${GREEN}SUCCESS: The '$image_set' image set has been copied to the target folder ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -78,4 +79,6 @@ while read -r line; do
|
|||
printf "$settings_data" | dd of="$def_target" bs=1 seek="$settings_addr" conv=notrunc
|
||||
done <"$settings_file"
|
||||
|
||||
echo -e "${GREEN}SUCCESS: The 'app_net_ready' settings have been applied ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
8
RESOURCES/OPTIONS/banner/banner
Normal file
8
RESOURCES/OPTIONS/banner/banner
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
████████╗██╗███╗ ██╗ █████╗ ███╗ ███╗ ██████╗ ██████╗ ██████╗ ███████╗██████╗ ██╗
|
||||
╚══██╔══╝██║████╗ ██║██╔══██╗ ████╗ ████║██╔═══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗██║
|
||||
██║ ██║██╔██╗ ██║███████║ ██╔████╔██║██║ ██║██║ ██║██║ ██║█████╗ ██║ ██║██║
|
||||
██║ ██║██║╚██╗██║██╔══██║ ██║╚██╔╝██║██║ ██║██║ ██║██║ ██║██╔══╝ ██║ ██║╚═╝
|
||||
██║ ██║██║ ╚████║██║ ██║ ██║ ╚═╝ ██║╚██████╔╝██████╔╝██████╔╝███████╗██████╔╝██╗
|
||||
╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═════╝ ╚═╝
|
||||
|
||||
Based on OpenWrt! | Tina Linux (Neptune, 619)
|
||||
51
RESOURCES/OPTIONS/banner/banner.sh
Executable file
51
RESOURCES/OPTIONS/banner/banner.sh
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
if [ $# != 2 ]; then
|
||||
echo "usage : $0 <project_root> <banner_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
project_root="$1"
|
||||
banner_file="$2"
|
||||
|
||||
# Echo the banner into $project_root/unpacked/etc/banner
|
||||
|
||||
# Check the required tools
|
||||
TOOL_LIST="cat"
|
||||
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
|
||||
done
|
||||
|
||||
# Check the project root folder
|
||||
if [ ! -d "$project_root" ]; then
|
||||
echo -e "${RED}ERROR: Cannot find the folder '$project_root' ${NC}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Check the banner exists
|
||||
if [ ! -f "$project_root/RESOURCES/OPTIONS/$banner_file/$banner_file" ]; then
|
||||
echo -e "${RED}ERROR: Cannot find the file '$banner_file' ${NC}"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Overwrite the banner file with ./banner if error then exit
|
||||
cat "$project_root/RESOURCES/OPTIONS/$banner_file/$banner_file" >"$project_root/unpacked/squashfs-root/etc/banner"
|
||||
if [ $? != 0 ]; then
|
||||
echo -e "${RED}ERROR: Cannot overwrite the banner file ${NC}"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}SUCCESS: The 'banner' file has been overwritten ${NC}"
|
||||
|
||||
exit 0
|
||||
72
RESOURCES/OPTIONS/bluetooth/bluetooth.sh
Executable file
72
RESOURCES/OPTIONS/bluetooth/bluetooth.sh
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/bash
|
||||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[0;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
if [ $# != 2 ]; then
|
||||
echo "usage : $0 <project_root>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
project_root="$1"
|
||||
|
||||
# check the required tools
|
||||
TOOL_LIST="rm"
|
||||
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
|
||||
done
|
||||
|
||||
# check the project root folder
|
||||
if [ ! -d "$project_root" ]; then
|
||||
echo -e "${RED}ERROR: Cannot find the folder '$project_root' ${NC}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Check the bluetooth folder and if exist then remove it
|
||||
|
||||
# A list of folders to remove
|
||||
# Create an array of folders to remove
|
||||
folders=(
|
||||
"etc/bluetooth"
|
||||
"etc/dbus-1/system.d/bluetooth*.conf"
|
||||
"lib/bluetooth"
|
||||
"lib/upgrade/keep.d/bluez-daemon"
|
||||
"usr/bin/bccmd"
|
||||
"usr/bin/bdaddr"
|
||||
"usr/bin/blue*"
|
||||
"usr/bin/bt*"
|
||||
"usr/lib/alsa-lib"
|
||||
"usr/lib/libbluetooth*"
|
||||
"usr/share/alsa/alsa.conf.d/20-bluealsa.conf"
|
||||
)
|
||||
|
||||
# Remove the folders and files
|
||||
# Check if folder or file and remove it
|
||||
for folder in "${folders[@]}"; do
|
||||
if [ -d "$project_root/unpacked/squashfs-root/$folder" ]; then
|
||||
echo "Removing folder: $project_root/unpacked/squashfs-root/$folder"
|
||||
rm -rf "$project_root/unpacked/squashfs-root/$folder"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}ERROR: Failed to remove folder: $project_root/unpacked/squashfs-root/$folder ${NC}"
|
||||
exit 3
|
||||
fi
|
||||
elif [ -f "$project_root/unpacked/squashfs-root/$folder" ]; then
|
||||
echo "Removing file: $project_root/unpacked/squashfs-root/$folder"
|
||||
rm -f "$project_root/unpacked/squashfs-root/$folder"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}ERROR: Failed to remove file: $project_root/unpacked/squashfs-root/$folder ${NC}"
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "${GREEN}SUCCESS: The 'bluetooth' has been removed ${NC}"
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -43,4 +44,6 @@ fi
|
|||
# copy the selected boot resource to the target
|
||||
/bin/cp -f "$boot_resource_file" "$target_folder"
|
||||
|
||||
echo -e "${GREEN}SUCCESS: The '$boot_resource' boot resource has been copied to the target folder ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -106,16 +107,19 @@ if [ "$app_ver" == "3.0.9" ]; then
|
|||
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
|
||||
echo -e "${GREEN}SUCCESS: The 'app' has been patched to support the webcam package (K2Pro) ${NC}"
|
||||
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
|
||||
echo -e "${GREEN}SUCCESS: The 'app' has been patched to support the webcam package (K2Plus) ${NC}"
|
||||
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
|
||||
echo -e "${GREEN}SUCCESS: The 'app' has been patched to support the webcam package (K2Max) ${NC}"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -35,4 +36,6 @@ fi
|
|||
# enable custom updates by providing a custom public key
|
||||
cp "$public_key" "$target_folder"
|
||||
|
||||
echo -e "${GREEN}SUCCESS: The custom public key has been copied to the target folder ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -59,4 +60,6 @@ unzip -o "$fswebcam_package_file"
|
|||
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$project_root/unpacked/squashfs-root/etc/profile"
|
||||
cd "$current_folder" || exit 8
|
||||
|
||||
echo -e "${GREEN}SUCCESS: The '$fswebcam_package' fswebcam package has been enabled ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# default urls to be replaced
|
||||
|
|
@ -38,7 +40,8 @@ for url in $mqtt_urls; do
|
|||
grep "$mqtt_url" "$def_target" &>>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${RED}ERROR: The 'app' might be already patched. Cannot find the expected URL '$mqtt_url' ${NC}"
|
||||
exit 3
|
||||
echo -e "${YELLOW}INFO: Will not patch the 'app' file...${NC}"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
@ -53,4 +56,6 @@ for url in $mqtt_urls; do
|
|||
printf "mqtts://%s:8883\x00" "$def_url" | dd of="$def_target" bs=1 seek="$offset" conv=notrunc &>>/dev/null
|
||||
done
|
||||
|
||||
echo -e "${GREEN}INFO: The 'app' file has been successfully patched with the custom MQTT URL ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -65,4 +66,6 @@ fi
|
|||
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$project_root/unpacked/squashfs-root/etc/profile"
|
||||
cd "$current_folder" || exit 8
|
||||
|
||||
echo -e "${GREEN}SUCCESS: The '$opkg_package' opkg package has been installed ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -59,4 +60,6 @@ unzip -o "$python_package_file"
|
|||
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$project_root/unpacked/squashfs-root/etc/profile"
|
||||
cd "$current_folder" || exit 8
|
||||
|
||||
echo -e "${GREEN}The python package has been successfully installed ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -41,4 +42,6 @@ fi
|
|||
shadow_temp="${target_file}_temp"
|
||||
awk "BEGIN{FS=\":\"; OFS=FS} \$1==\"root\"{\$2=\"$password_hash\"} {print}" "$target_file" >"$shadow_temp" && mv "$shadow_temp" "$target_file"
|
||||
|
||||
echo -e "${GREEN}Root access enabled${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -65,4 +66,6 @@ fi
|
|||
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$project_root/unpacked/squashfs-root/etc/profile"
|
||||
cd "$current_folder" || exit 8
|
||||
|
||||
echo -e "${GREEN}The ssh package has been successfully installed ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -52,4 +53,6 @@ cp -rf "$project_root/RESOURCES/OPTIONS/startup_script/$startup_script" "$projec
|
|||
# Add /etc/$startup_script to $project_root/unpacked/squashfs-root/etc/rc.local before the exit 0 line
|
||||
sed -i "/exit 0/i /etc/$startup_script" "$project_root/unpacked/squashfs-root/etc/rc.local"
|
||||
|
||||
echo -e "${GREEN}INFO: Startup script '$startup_script' has been installed ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
# check the parameters
|
||||
|
|
@ -57,4 +58,6 @@ cd "$target_folder" || exit 7
|
|||
unzip -o "$uart_package_file"
|
||||
cd "$current_folder" || exit 8
|
||||
|
||||
echo -e "${GREEN}INFO: The UART package has been installed. Version: $uart_package ${NC}"
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ python="3.11"
|
|||
# It requires the options: [python], [fswebcam] and [ssh]
|
||||
#camera="3d-visualizer.run" [python] [fswebcam] [ssh]
|
||||
|
||||
# Change the banner to a custom one. (Recommended when custom firmware)
|
||||
banner="banner"
|
||||
|
||||
# Enable the web interface Kobra Unleashed
|
||||
# More information: https://github.com/anjomro/kobra-unleashed
|
||||
# Replace the URL below with the URL of your MQTT server
|
||||
|
|
@ -72,6 +75,10 @@ python="3.11"
|
|||
# Always keep a copy of the original keys in case you want to go back to AC cloud
|
||||
kobra_unleashed="localhost.mr-a.de"
|
||||
|
||||
# Delete the Bluetooth support because it's not used by Kobra Unleashed
|
||||
# and can't be used since we replace mqtt anyways.
|
||||
bluetooth="default"
|
||||
|
||||
# Patch the app to check the captive portal URLs less often (originally every 2s)
|
||||
# It is used to detect if the internet connection is established and alive
|
||||
# This patch will produce less unwanted web traffic if enabled
|
||||
|
|
|
|||
3
patch.sh
3
patch.sh
|
|
@ -9,6 +9,7 @@ installed_options="installed_options.log"
|
|||
# global definitions:
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
PURPLE='\033[0;35m'
|
||||
NC='\033[0m'
|
||||
project_root="$PWD"
|
||||
|
||||
|
|
@ -45,7 +46,7 @@ options=$(awk -F '=' '{if (! ($0 ~ /^;/) && ! ($0 ~ /^#/) && ! ($0 ~ /^$/) && !
|
|||
|
||||
# for each enabled option
|
||||
for option in $options; do
|
||||
echo "Processing option '$option' ..."
|
||||
echo -e "${PURPLE}Processing option '$option' ...${NC}"
|
||||
# parse the parameters (only from the first found option)
|
||||
# duplicated options are not supported, if needed use list of parameters for the same option:
|
||||
# startup_script="script1.sh" "script2.sh" "script3.sh"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue