From 532935b04a20afe8c178502bac1d332927ab2b7e Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 4 Oct 2023 01:46:13 +0000 Subject: [PATCH] Add 'compile.sh' --- compile.sh | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 compile.sh diff --git a/compile.sh b/compile.sh new file mode 100644 index 0000000..95c0e9c --- /dev/null +++ b/compile.sh @@ -0,0 +1,118 @@ +#!/bin/bash + +# Script to compile a single openwrt package if the lxc-compile.sh script has already been run + +print_success() { echo -e "\e[32m${@}\e[0m"; } +print_error() { echo -e "\e[31m${@}\e[0m"; } + +if [ `whoami` != "root" ] && [ `whoami` != "forge" ] && [ `whoami` != "homestead" ] && [ `whoami` != "vagrant" ]; +then + print_error "You must be root to run this script!" + exit 1 +fi + +# Ask user for router choice: +echo "What router do you want to build packages for today?" +select opt in "x86" "Gli gl-a1300, Gli bl1300" "TPLink Archer C7, Gli Crete ar750" "ASUS RT-ac88u" "Linksys E8450, BPI-R64" "gl-mt1300" "Linksys WRT32x, AC3200acm" "glinet-xe300, gli Shadow, Slate" "mt300nv2 Yellow mini"; do + case $opt in + "x86") folder="openwrt-sdk-21.02.7-x86-64_gcc-8.4.0_musl.Linux-x86_64";; + "Gli gl-a1300, Gli bl1300") folder="openwrt-sdk-23.05.0-rc2-ipq40xx-generic_gcc-12.3.0_musl_eabi.Linux-x86_64";; + "TPLink Archer C7, Gli Crete ar750") folder="openwrt-sdk-22.03.3-ath79-generic_gcc-11.2.0_musl.Linux-x86_64";; + "ASUS RT-ac88u") folder="openwrt-sdk-22.03.5-bcm53xx-generic_gcc-11.2.0_musl_eabi.Linux-x86_64";; + "Linksys E8450, BPI-R64") folder="openwrt-sdk-22.03.5-mediatek-mt7622_gcc-11.2.0_musl.Linux-x86_64";; + "gl-mt1300") folder="openwrt-sdk-21.02.6-ramips-mt7621_gcc-8.4.0_musl.Linux-x86_64";; + "Linksys WRT32x, AC3200acm") folder="openwrt-sdk-22.03.0-mvebu-cortexa9_gcc-11.2.0_musl_eabi.Linux-x86_64";; + "glinet-xe300, gli Shadow, Slate") folder="openwrt-sdk-22.03.0-mvebu-cortexa9_gcc-11.2.0_musl_eabi.Linux-x86_64";; + "mt300nv2 Yellow mini") folder="openwrt-sdk-21.02.3-ramips-mt76x8_gcc-8.4.0_musl.Linux-x86_64";; + *) echo "Invalid option";; + esac + break +done + +# Ensure SDK folder exists +if [[ ! -d $folder ]]; then + print_error "The specified SDK folder does not exist!" + exit 1 +fi + +# Move to SDK folder +cd $folder + +# Show available luci-app packages +apps=( + "luci-app-frigate" + "luci-app-easymesh" + "luci-app-atinout" + "luci-app-cellled" + "luci-app-mmconfig" + "luci-app-smstools3" + "luci-app-modeminfo" + "luci-app-btcpayserver" + "luci-theme-privaterouter" + "luci-app-nodered" + "luci-app-autogpt" + "luci-app-megamedia" + "luci-app-rtorrent" + "luci-app-webtop" + "luci-app-shortcutmenu" + "luci-app-plex" + "luci-app-filebrowser" + "luci-app-nextcloud" + "luci-app-seafile" + "luci-app-heimdall" + "luci-app-motioneye" + "luci-app-joplin" + "luci-app-ghostblog" + "luci-app-emby" + "luci-app-jellyfin" + "luci-app-prowlarr" + "luci-app-wordpress" + "luci-app-gitea" + "luci-app-libreddit" + "luci-app-whoogle" + "luci-app-vaultwarden" + "luci-app-mastodon" + "luci-app-discourse" + "luci-app-gotify" + "luci-app-jitsi" + "luci-app-owncast" + "luci-app-neko" + "luci-app-alltube" + "luci-app-bookstack" + "luci-app-searxng" + "luci-app-homeassistant" + "luci-app-photoprism" + "luci-app-qbittorrent" + "luci-app-simplex" + "luci-app-chatgpt" + "luci-app-lxc-attach" + "luci-app-fileassistant" +) + +echo "Which OpenWRT luci-app package would you like to compile?" +select app in "${apps[@]}"; do + # Check app validity + if [[ " ${apps[@]} " =~ " ${app} " ]]; then + break + else + echo "Invalid option" + fi +done + +# Compile selected app +base_url="https://gittylab.com/ben/" +git_url="${base_url}${app}" + +# Find directories named "libexec" and apply chmod +x to them and their contents recursively +find . -type d -name "libexec" -exec chmod -R +x {} \; + +echo "Permissions have been set for all 'libexec' directories and their contents." + +git clone $git_url package/$app +./scripts/feeds update -a +./scripts/feeds install -a +make menuconfig # Let the user choose configuration +make package/$app/clean +make package/$app/compile + +print_success "Compilation complete!" \ No newline at end of file