Compare commits
3 Commits
d51c9e6359
...
6f6d92b659
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f6d92b659 | |||
| 961a87fb6c | |||
| 63cd99cd4d |
25
README.md
25
README.md
@@ -1,6 +1,6 @@
|
|||||||
# openwrtbuilder
|
# openwrtbuilder
|
||||||
|
|
||||||
Sanely build and deploy OpenWRT images using the Image Builder or from source code
|
Sanely build and deploy OpenWRT images using the Image Builder or from source code.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -11,20 +11,21 @@ Sanely build and deploy OpenWRT images using the Image Builder or from source co
|
|||||||
```(text)
|
```(text)
|
||||||
--profile,-p PROFILE
|
--profile,-p PROFILE
|
||||||
--release,-r,--version,-v RELEASE ("snapshot", "22.03.3")
|
--release,-r,--version,-v RELEASE ("snapshot", "22.03.3")
|
||||||
--buildroot,-b PATH
|
--buildroot,-b PATH (Default: script directory)
|
||||||
Default: location of openwrtbuilder script
|
|
||||||
--source
|
--source
|
||||||
Build image from source, not from Image Builder
|
Build image from source, not from Image Builder
|
||||||
Allows make config options to be passed
|
Allows make config options to be passed in profile
|
||||||
--ssh-upgrade HOST
|
--ssh-upgrade HOST
|
||||||
Example: root@192.168.1.1
|
Example: root@192.168.1.1
|
||||||
--ssh-backup SSH_PATH
|
--ssh-backup SSH_PATH
|
||||||
Enabled by default for --ssh-upgrade
|
Enabled by default for --ssh-upgrade
|
||||||
--flash,-f DEVICE
|
--flash,-f DEVICE
|
||||||
Example: /dev/sdX
|
Example: /dev/sdX
|
||||||
--reset
|
--reset
|
||||||
Cleanup all source and output files
|
Cleanup all source and output files
|
||||||
Can be combined with -p to reset a specific profile
|
Can be combined with -p to reset a specific profile
|
||||||
|
--yes,-y
|
||||||
|
Assume yes for all questions (automatic mode)
|
||||||
--debug,-d
|
--debug,-d
|
||||||
--help,-h
|
--help,-h
|
||||||
```
|
```
|
||||||
@@ -36,8 +37,8 @@ See `./profiles` for example device profile definitions.
|
|||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
* `./openwrtbuilder -p r4s -r snapshot --debug`
|
* `./openwrtbuilder -p r4s -r snapshot --debug`
|
||||||
* `./openwrtbuilder -p ax6000 -r 22.03.3 --source --debug`
|
* `./openwrtbuilder -p ax6000 -r 23.05.5 --source --debug`
|
||||||
* `./openwrtbuilder -p rpi4 -r 22.03.3 --flash /dev/sdX`
|
* `./openwrtbuilder -p rpi4 -r 23.05.5 --flash /dev/sdX`
|
||||||
* `./openwrtbuilder -p linksys -r snapshot --ssh-upgrade root@192.168.1.1`
|
* `./openwrtbuilder -p linksys -r snapshot --ssh-upgrade root@192.168.1.1`
|
||||||
|
|
||||||
## Additional Info
|
## Additional Info
|
||||||
|
|||||||
316
openwrtbuilder
316
openwrtbuilder
@@ -153,161 +153,164 @@ parse_input() {
|
|||||||
|
|
||||||
install_dependencies() {
|
install_dependencies() {
|
||||||
debug "${FUNCNAME[0]}"
|
debug "${FUNCNAME[0]}"
|
||||||
local lock_file="$BUILDROOT/.dependencies"
|
|
||||||
local -a pkg_list
|
local -a pkg_list
|
||||||
|
local lock_file
|
||||||
# TODO please contribute your platform here
|
|
||||||
if ((FROM_SOURCE)); then
|
if ((FROM_SOURCE)); then
|
||||||
# For building from source with make
|
lock_file="$BUILDROOT/.dependencies_sc"
|
||||||
# https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem
|
|
||||||
case "$ID" in
|
|
||||||
fedora|centos)
|
|
||||||
pkg_list+=(
|
|
||||||
"bash-completion"
|
|
||||||
"bzip2"
|
|
||||||
"gcc"
|
|
||||||
"gcc-c++"
|
|
||||||
"git"
|
|
||||||
"make"
|
|
||||||
"ncurses-devel"
|
|
||||||
"patch"
|
|
||||||
"rsync"
|
|
||||||
"tar"
|
|
||||||
"unzip"
|
|
||||||
"wget"
|
|
||||||
"which"
|
|
||||||
"diffutils"
|
|
||||||
"python2"
|
|
||||||
"python3"
|
|
||||||
"python3-setuptools"
|
|
||||||
"python3-pyelftools"
|
|
||||||
"perl-base"
|
|
||||||
"perl-Data-Dumper"
|
|
||||||
"perl-File-Compare"
|
|
||||||
"perl-File-Copy"
|
|
||||||
"perl-FindBin"
|
|
||||||
"perl-IPC-Cmd"
|
|
||||||
"perl-Thread-Queue"
|
|
||||||
"perl-Time-Piece"
|
|
||||||
"perl-JSON-PP"
|
|
||||||
"swig"
|
|
||||||
"clang" # for qosify
|
|
||||||
"llvm15-libs"
|
|
||||||
"patch")
|
|
||||||
;;
|
|
||||||
debian|ubuntu)
|
|
||||||
pkg_list+=(
|
|
||||||
"build-essential"
|
|
||||||
"clang"
|
|
||||||
"flex"
|
|
||||||
"g++"
|
|
||||||
"gawk"
|
|
||||||
"gcc-multilib"
|
|
||||||
"gettext"
|
|
||||||
"git"
|
|
||||||
"libncurses5-dev"
|
|
||||||
"libssl-dev"
|
|
||||||
"python3-distutils"
|
|
||||||
"rsync"
|
|
||||||
"unzip"
|
|
||||||
"zlib1g-dev"
|
|
||||||
"file"
|
|
||||||
"wget"
|
|
||||||
"patch")
|
|
||||||
;;
|
|
||||||
arch)
|
|
||||||
pkg_list+=(
|
|
||||||
"base-devel"
|
|
||||||
"autoconf"
|
|
||||||
"automake"
|
|
||||||
"bash"
|
|
||||||
"binutils"
|
|
||||||
"bison"
|
|
||||||
"bzip2"
|
|
||||||
"clang"
|
|
||||||
"fakeroot"
|
|
||||||
"file"
|
|
||||||
"findutils"
|
|
||||||
"flex"
|
|
||||||
"gawk"
|
|
||||||
"gcc"
|
|
||||||
"gettext"
|
|
||||||
"git"
|
|
||||||
"grep"
|
|
||||||
"groff"
|
|
||||||
"gzip"
|
|
||||||
"libelf"
|
|
||||||
"libtool"
|
|
||||||
"libxslt"
|
|
||||||
"m4"
|
|
||||||
"make"
|
|
||||||
"ncurses"
|
|
||||||
"openssl"
|
|
||||||
"patch"
|
|
||||||
"pkgconf"
|
|
||||||
"python"
|
|
||||||
"rsync"
|
|
||||||
"sed"
|
|
||||||
"texinfo"
|
|
||||||
"time"
|
|
||||||
"unzip"
|
|
||||||
"util-linux"
|
|
||||||
"wget"
|
|
||||||
"which"
|
|
||||||
"zlib"
|
|
||||||
"patch")
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
debug "Skipping dependency install, your OS is unsupported"
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
else
|
||||||
# For Imagebuilder
|
lock_file="$BUILDROOT/.dependencies_ib"
|
||||||
case "$ID" in
|
fi
|
||||||
fedora|centos)
|
|
||||||
pkg_list+=(
|
if [[ ! -f $lock_file ]]; then
|
||||||
"@c-development"
|
if ((FROM_SOURCE)); then
|
||||||
"@development-tools"
|
# For building from source code
|
||||||
"@development-libs"
|
# https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem
|
||||||
"perl-FindBin"
|
case "$ID" in
|
||||||
"zlib-static"
|
fedora|centos)
|
||||||
"elfutils-libelf-devel"
|
pkg_list+=(
|
||||||
"gawk"
|
"bash-completion"
|
||||||
"unzip"
|
"bzip2"
|
||||||
"file"
|
"gcc"
|
||||||
"wget"
|
"gcc-c++"
|
||||||
"python3"
|
"git"
|
||||||
"python2"
|
"make"
|
||||||
"axel"
|
"ncurses-devel"
|
||||||
"perl-IPC-Cmd")
|
"patch"
|
||||||
;;
|
"rsync"
|
||||||
debian|ubuntu)
|
"tar"
|
||||||
pkg_list+=(
|
"unzip"
|
||||||
"build-essential"
|
"wget"
|
||||||
"libncurses5-dev"
|
"which"
|
||||||
"libncursesw5-dev"
|
"diffutils"
|
||||||
"zlib1g-dev"
|
"python2"
|
||||||
"gawk"
|
"python3"
|
||||||
"git"
|
"python3-setuptools"
|
||||||
"gettext"
|
"python3-pyelftools"
|
||||||
"libssl-dev"
|
"perl-base"
|
||||||
"xsltproc"
|
"perl-Data-Dumper"
|
||||||
"wget"
|
"perl-File-Compare"
|
||||||
"unzip"
|
"perl-File-Copy"
|
||||||
"python"
|
"perl-FindBin"
|
||||||
"axel")
|
"perl-IPC-Cmd"
|
||||||
;;
|
"perl-Thread-Queue"
|
||||||
*)
|
"perl-Time-Piece"
|
||||||
debug "Skipping dependency install, your OS is unsupported"
|
"perl-JSON-PP"
|
||||||
return 1
|
"swig"
|
||||||
;;
|
"clang" # for qosify
|
||||||
esac
|
"llvm15-libs"
|
||||||
|
"patch")
|
||||||
|
;;
|
||||||
|
debian|ubuntu)
|
||||||
|
pkg_list+=(
|
||||||
|
"build-essential"
|
||||||
|
"clang"
|
||||||
|
"flex"
|
||||||
|
"g++"
|
||||||
|
"gawk"
|
||||||
|
"gcc-multilib"
|
||||||
|
"gettext"
|
||||||
|
"git"
|
||||||
|
"libncurses5-dev"
|
||||||
|
"libssl-dev"
|
||||||
|
"python3-distutils"
|
||||||
|
"rsync"
|
||||||
|
"unzip"
|
||||||
|
"zlib1g-dev"
|
||||||
|
"file"
|
||||||
|
"wget"
|
||||||
|
"patch")
|
||||||
|
;;
|
||||||
|
arch)
|
||||||
|
pkg_list+=(
|
||||||
|
"base-devel"
|
||||||
|
"autoconf"
|
||||||
|
"automake"
|
||||||
|
"bash"
|
||||||
|
"binutils"
|
||||||
|
"bison"
|
||||||
|
"bzip2"
|
||||||
|
"clang"
|
||||||
|
"fakeroot"
|
||||||
|
"file"
|
||||||
|
"findutils"
|
||||||
|
"flex"
|
||||||
|
"gawk"
|
||||||
|
"gcc"
|
||||||
|
"gettext"
|
||||||
|
"git"
|
||||||
|
"grep"
|
||||||
|
"groff"
|
||||||
|
"gzip"
|
||||||
|
"libelf"
|
||||||
|
"libtool"
|
||||||
|
"libxslt"
|
||||||
|
"m4"
|
||||||
|
"make"
|
||||||
|
"ncurses"
|
||||||
|
"openssl"
|
||||||
|
"patch"
|
||||||
|
"pkgconf"
|
||||||
|
"python"
|
||||||
|
"rsync"
|
||||||
|
"sed"
|
||||||
|
"texinfo"
|
||||||
|
"time"
|
||||||
|
"unzip"
|
||||||
|
"util-linux"
|
||||||
|
"wget"
|
||||||
|
"which"
|
||||||
|
"zlib"
|
||||||
|
"patch")
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
debug "Skipping dependency install, your OS is unsupported"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
# For Imagebuilder
|
||||||
|
case "$ID" in
|
||||||
|
fedora|centos)
|
||||||
|
pkg_list+=(
|
||||||
|
"@c-development"
|
||||||
|
"@development-tools"
|
||||||
|
"@development-libs"
|
||||||
|
"perl-FindBin"
|
||||||
|
"zlib-static"
|
||||||
|
"elfutils-libelf-devel"
|
||||||
|
"gawk"
|
||||||
|
"unzip"
|
||||||
|
"file"
|
||||||
|
"wget"
|
||||||
|
"python3"
|
||||||
|
"python2"
|
||||||
|
"axel"
|
||||||
|
"perl-IPC-Cmd")
|
||||||
|
;;
|
||||||
|
debian|ubuntu)
|
||||||
|
pkg_list+=(
|
||||||
|
"build-essential"
|
||||||
|
"libncurses5-dev"
|
||||||
|
"libncursesw5-dev"
|
||||||
|
"zlib1g-dev"
|
||||||
|
"gawk"
|
||||||
|
"git"
|
||||||
|
"gettext"
|
||||||
|
"libssl-dev"
|
||||||
|
"xsltproc"
|
||||||
|
"wget"
|
||||||
|
"unzip"
|
||||||
|
"python"
|
||||||
|
"axel")
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
debug "Skipping dependency install, your OS is unsupported"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Skip dependency installation if lock file is present
|
|
||||||
[[ -f $lock_file ]] && return
|
|
||||||
|
|
||||||
pkg_install "${pkg_list[@]}" && echo "${pkg_list[@]}" > "$lock_file"
|
pkg_install "${pkg_list[@]}" && echo "${pkg_list[@]}" > "$lock_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,10 +772,15 @@ main() {
|
|||||||
extract "$ib_file" "$BUILDDIR" || return $?
|
extract "$ib_file" "$BUILDDIR" || return $?
|
||||||
add_repos
|
add_repos
|
||||||
make_images
|
make_images
|
||||||
# Verify output iamges
|
# Verify output image for stock builds (in testing)
|
||||||
for outfile in "$BINDIR"/*.img.gz; do
|
if [[ ! -v P_ARR[packages] || -z ${P_ARR[packages]} ]]; then
|
||||||
verify "$outfile" "$ib_sha256_file" || return 1
|
shopt -s nullglob
|
||||||
done
|
local -a outfiles=("$BINDIR"/*.img.gz "$BINDIR"/*.img)
|
||||||
|
shopt -u nullglob
|
||||||
|
for outfile in "${outfiles[@]}"; do
|
||||||
|
verify "$outfile" "$ib_sha256_file" || return 1
|
||||||
|
done
|
||||||
|
fi
|
||||||
#copyFiles
|
#copyFiles
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user