#
# busybox
#

# Package metadata
PACKAGE_NAME="busybox"
PACKAGE_VER="1.36.0"
PACKAGE_DESC="Busybox embedded UNIX utilities"
MAINTAINER="liamwaldron@everestlinux.org"
LICENSE="GPL v2"
ARCH="x86"
INCLUDED_FILES=("/bin/busybox" "/linuxrc")

# Integrity checking
SHA256SUMS="2d60a4df73d14da518c3e8a7d51830c35918b54572029624ea4b86e8298fb528"

# Dependency information
DEPENDS=("")
CONFLICTS=("")

# Source information
PACKAGE_SRC="https://git.busybox.net/busybox"
SOURCES=("busybox-1.36.0")

# Installation
getsource() {
	wget $PACKAGE_SRC
	cd ${SOURCES[0]}
}

buildpkg() {
	curl https://git.everestlinux.org/EverestLinux/sys-pkg-configs/raw/branch/main/config.busybox-1.36.0 -o .config
	make ARCH="x86_64" CROSS_COMPILE="x86_64-linux-musl-" # these MUST be set
}

installpkg() {
	make ARCH="x86_64" CROSS_COMPILE="x86_64-linux-musl-" \
	CONFIG_PREFIX="${BLDR_OUT_DIR}/pkgs/busybox" install
	cp -v examples/depmod.pl ${TOOLCHAIN_PATH}/bin
	chmod -v 755 ${TOOLCHAIN_PATH}/bin/depmod.pl
	touch ${BLDR_OUT_DIR}/pkgs/busybox/.ispkg
	# Never install files to /bin, they will get
	# overwritten when the user pulls a new update
}

installpkg_system() {
	printf "Not supported for this package.\n"
	exit 1
}

removepkg() {
	rm -rf ${BLDR_OUT_DIR}/pkgs/busybox
}

removepkg_system() {
	printf "Not supported for this package.\n"
	exit 1
}

updatepkg() {
	buildpkg "$@"
	installpkg "$@"
}

updatepkg_system() {
	printf "Not supported for this package.\n"
	exit 1
}

#
# end busybox
#
