diff --git a/makefile b/makefile index 4f6cfc0..711d164 100644 --- a/makefile +++ b/makefile @@ -24,7 +24,7 @@ OUTNAME=PrawnOS-$(PRAWNOS_SUITE)-c201.img BASE=$(OUTNAME)-BASE PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) -include $(PRAWNOS_ROOT)/scripts/common.mk +include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk #Usage: @@ -98,22 +98,22 @@ build_dirs: kernel: $(MAKE) build_dirs rm -rf build/logs/kernel-log.txt - ./scripts/buildKernel.sh $(KVER) 2>&1 | tee build/logs/kernel-log.txt + $(PRAWNOS_KERNEL_SCRIPTS_BUILD) $(KVER) 2>&1 | tee build/logs/kernel-log.txt .PHONY: kernel_config kernel_config: - scripts/crossmenuconfig.sh $(KVER) + $(PRAWNOS_KERNEL_SCRIPTS_MENUCONFIG) $(KVER) .PHONY: patch_kernel patch_kernel: - scripts/patchKernel.sh + $(PRAWNOS_KERNEL_SCRIPTS_PATCH) #:::::::::::::::::::::::::::::: initramfs ::::::::::::::::::::::::::::::::: .PHONY: initramfs initramfs: $(MAKE) build_dirs rm -rf build/logs/initramfs-log.txt - ./scripts/buildInitramFs.sh $(BASE) 2>&1 | tee build/logs/initramfs-log.txt + $(PRAWNOS_INITRAMFS_SCRIPTS_BUILD) $(BASE) 2>&1 | tee build/logs/initramfs-log.txt #:::::::::::::::::::::::::::::: filesystem :::::::::::::::::::::::::::::::: #makes the base filesystem image without kernel. Only make a new one if the base image isnt present @@ -123,8 +123,7 @@ filesystem: rm -rf build/logs/fs-log.txt $(MAKE) pbuilder_create $(MAKE) packages - [ -f $(BASE) ] || ./scripts/buildFilesystem.sh $(KVER) $(DEBIAN_SUITE) $(BASE) $(PRAWNOS_ROOT) 2>&1 | tee build/logs/fs-log.txt - + [ -f $(BASE) ] || $(PRAWNOS_FILESYSTEM_SCRIPTS_BUILD) $(KVER) $(DEBIAN_SUITE) $(BASE) $(PRAWNOS_ROOT) $(PRAWNOS_SHARED_SCRIPTS) 2>&1 | tee build/logs/fs-log.txt #:::::::::::::::::::::::::::::: packages :::::::::::::::::::::::::::::::: .PHONY: packages @@ -140,9 +139,9 @@ endif #:::::::::::::::::::::::::::::: image management :::::::::::::::::::::::::: -.PHONY: kernel_inject +.PHONY: kernel_install kernel_inject: #Targets an already built .img and swaps the old kernel with the newly compiled kernel - scripts/injectKernelIntoFS.sh $(KVER) $(OUTNAME) + $(PRAWNOS_IMAGE_SCRIPTS_INSTALL_KERNEL) $(KVER) $(OUTNAME) .PHONY: kernel_update kernel_update: @@ -150,7 +149,7 @@ kernel_update: $(MAKE) initramfs $(MAKE) kernel cp $(BASE) $(OUTNAME) - $(MAKE) kernel_inject + $(MAKE) kernel_install .PHONY: image image: @@ -159,7 +158,7 @@ image: $(MAKE) initramfs $(MAKE) kernel cp $(BASE) $(OUTNAME) - $(MAKE) kernel_inject + $(MAKE) kernel_install #:::::::::::::::::::::::::::::: pbuilder management ::::::::::::::::::::::: .PHONY: pbuilder_create diff --git a/packages/filesystem/flashmap/makefile b/packages/filesystem/flashmap/makefile index 82e8d5b..9d1b3d9 100644 --- a/packages/filesystem/flashmap/makefile +++ b/packages/filesystem/flashmap/makefile @@ -1,6 +1,6 @@ #import all shared make vars PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) -include $(PRAWNOS_ROOT)/scripts/common.mk +include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk #package specific vars VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version) @@ -10,7 +10,7 @@ PACKAGE_NAME_DEB := $(PACKAGE_NAME).deb PACKAGE_LOCAL_BUILD_DEPS := $(PACKAGE_NAME_DEB): - $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD_PACKAGE) $(PACKAGE_NAME_DEB) \ + $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD) $(PACKAGE_NAME_DEB) \ $(PBUILDER_VARS) \ $(PRAWNOS_LOCAL_APT_VARS) \ $(PACKAGE_LOCAL_BUILD_DEPS) @@ -28,8 +28,8 @@ clean: rm -rf *.buildinfo install: - $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL_PACKAGE) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) + $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) .PHONY: upload upload: - $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD_PACKAGE) + $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD) diff --git a/packages/filesystem/font-source-code-pro/makefile b/packages/filesystem/font-source-code-pro/makefile index 2fac281..eda57e8 100644 --- a/packages/filesystem/font-source-code-pro/makefile +++ b/packages/filesystem/font-source-code-pro/makefile @@ -1,6 +1,6 @@ #import all shared make vars PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) -include $(PRAWNOS_ROOT)/scripts/common.mk +include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk #package specific vars VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version) @@ -26,8 +26,8 @@ clean: rm -rf *.buildinfo install: - $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL_PACKAGE) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) + $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) .PHONY: upload upload: - $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD_PACKAGE) + $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD) diff --git a/packages/filesystem/makefile b/packages/filesystem/makefile index 99884ec..11ca8ae 100644 --- a/packages/filesystem/makefile +++ b/packages/filesystem/makefile @@ -1,5 +1,5 @@ PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) -include $(PRAWNOS_ROOT)/scripts/common.mk +include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk SUBDIRS = $(shell ls -d */) diff --git a/packages/filesystem/mosys/makefile b/packages/filesystem/mosys/makefile index 400ee1a..c3dd922 100644 --- a/packages/filesystem/mosys/makefile +++ b/packages/filesystem/mosys/makefile @@ -1,6 +1,6 @@ #import all shared make vars PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) -include $(PRAWNOS_ROOT)/scripts/common.mk +include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk #package specific vars VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version) @@ -10,7 +10,7 @@ PACKAGE_NAME_DEB := $(PACKAGE_NAME).deb PACKAGE_LOCAL_BUILD_DEPS := flashmap $(PACKAGE_NAME_DEB): - $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD_PACKAGE) $(PACKAGE_NAME_DEB) \ + $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD) $(PACKAGE_NAME_DEB) \ $(PBUILDER_VARS) \ $(PRAWNOS_LOCAL_APT_VARS) \ $(PACKAGE_LOCAL_BUILD_DEPS) @@ -28,8 +28,8 @@ clean: rm -rf *.buildinfo install: - $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL_PACKAGE) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) + $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) .PHONY: upload upload: - $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD_PACKAGE) + $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD) diff --git a/packages/filesystem/xsecurelock/makefile b/packages/filesystem/xsecurelock/makefile index 5205c28..3069f4c 100644 --- a/packages/filesystem/xsecurelock/makefile +++ b/packages/filesystem/xsecurelock/makefile @@ -1,6 +1,6 @@ #import all shared make vars PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) -include $(PRAWNOS_ROOT)/scripts/common.mk +include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk #package specific vars VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version) @@ -10,7 +10,7 @@ PACKAGE_NAME_DEB := $(PACKAGE_NAME).deb PACKAGE_LOCAL_BUILD_DEPS := $(PACKAGE_NAME_DEB): - $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD_PACKAGE) $(PACKAGE_NAME_DEB) \ + $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD) $(PACKAGE_NAME_DEB) \ $(PBUILDER_VARS) \ $(PRAWNOS_LOCAL_APT_VARS) \ $(PACKAGE_LOCAL_BUILD_DEPS) @@ -28,9 +28,9 @@ clean: rm -rf *.buildinfo install: - $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL_PACKAGE) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) + $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) .PHONY: upload upload: - $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD_PACKAGE) + $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD) diff --git a/packages/initramfs/makefile b/packages/initramfs/makefile index d9937ce..f8817f6 100644 --- a/packages/initramfs/makefile +++ b/packages/initramfs/makefile @@ -1,5 +1,5 @@ PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) -include $(PRAWNOS_ROOT)/scripts/common.mk +include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk all: @echo TODO diff --git a/packages/makefile b/packages/makefile index ec8ff78..8313b3d 100644 --- a/packages/makefile +++ b/packages/makefile @@ -1,5 +1,5 @@ PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) -include $(PRAWNOS_ROOT)/scripts/common.mk +include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk SUBDIRS = $(shell ls -d */) @@ -16,7 +16,7 @@ clean: install: - @echo packages install target is $(INSTALL_TARGET) + $(info packages install target is $(INSTALL_TARGET)) for dir in $(SUBDIRS) ; do \ make install INSTALL_TARGET=$(INSTALL_TARGET) -C $$dir ; \ done diff --git a/scripts/BuildScripts/BuildCommon.mk b/scripts/BuildScripts/BuildCommon.mk new file mode 100644 index 0000000..c22c910 --- /dev/null +++ b/scripts/BuildScripts/BuildCommon.mk @@ -0,0 +1,62 @@ +ifndef BUILD_COMMON_MK +BUILD_COMMON_MK := 1 + +#Place all shared make vars below +#========================================================================================= +PRAWNOS_BUILD := $(PRAWNOS_ROOT)/build + +PRAWNOS_SCRIPTS := $(PRAWNOS_ROOT)/scripts + +### BUILD SCRIPTS +PRAWNOS_BUILD_SCRIPTS := $(PRAWNOS_SCRIPTS)/BuildScripts + +PRAWNOS_FILESYSTEM_SCRIPTS := $(PRAWNOS_BUILD_SCRIPTS)/FilesystemScripts +PRAWNOS_FILESYSTEM_SCRIPTS_BUILD := $(PRAWNOS_FILESYSTEM_SCRIPTS)/buildFilesystem.sh + +PRAWNOS_KERNEL_SCRIPTS := $(PRAWNOS_BUILD_SCRIPTS)/KernelScripts +PRAWNOS_KERNEL_SCRIPTS_BUILD := $(PRAWNOS_KERNEL_SCRIPTS)/buildKernel.sh +PRAWNOS_KERNEL_SCRIPTS_MENUCONFIG := $(PRAWNOS_KERNEL_SCRIPTS)/crossMenuConfig.sh +PRAWNOS_KERNEL_SCRIPTS_PATCH := $(PRAWNOS_KERNEL_SCRIPTS)/patchKernel.sh + +PRAWNOS_IMAGE_SCRIPTS := $(PRAWNOS_BUILD_SCRIPTS)/ImageScripts +PRAWNOS_IMAGE_SCRIPTS_INSTALL_KERNEL := $(PRAWNOS_IMAGE_SCRIPTS)/installKernelToFs.sh + +PRAWNOS_INITRAMFS_SCRIPTS := $(PRAWNOS_BUILD_SCRIPTS)/InitramfsScripts +PRAWNOS_INITRAMFS_SCRIPTS_BUILD := $(PRAWNOS_INITRAMFS_SCRIPTS)/buildInitramFs.sh + +PRAWNOS_PACKAGE_SCRIPTS := $(PRAWNOS_BUILD_SCRIPTS)/PackageScripts +PRAWNOS_PACKAGE_SCRIPTS_INSTALL := $(PRAWNOS_PACKAGE_SCRIPTS)/installPackage.sh +PRAWNOS_PACKAGE_SCRIPTS_PBUILD := $(PRAWNOS_PACKAGE_SCRIPTS)/pbuildPackage.sh +PRAWNOS_PACKAGE_SCRIPTS_UPLOAD := $(PRAWNOS_PACKAGE_SCRIPTS)/uploadPackage.sh + + +### INSTALL SCRIPTS +PRAWNOS_INSTALL_SCRIPTS := $(PRAWNOS_SCRIPTS)/InstallScripts + + +### SHARED SCRIPTS +PRAWNOS_SHARED_SCRIPTS := $(PRAWNOS_SCRIPTS)/Shared + +PRAWNOS_SHARED_SCRIPTS_PACKAGE_LISTS := $(PRAWNOS_SHARED_SCRIPTS)/package_lists.sh + +### PBUILDER RESOURCES +PBUILDER_DIR := $(PRAWNOS_ROOT)/resources/BuildResources/pbuilder +PBUILDER_CHROOT := $(PRAWNOS_BUILD)/prawnos-pbuilder-armhf-base.tgz +PBUILDER_RC := $(PBUILDER_DIR)/prawnos-pbuilder.rc +PBUILDER_HOOKS := $(PBUILDER_DIR)/hooks + +PBUILDER_VARS := $(PBUILDER_CHROOT) $(PBUILDER_RC) $(PBUILDER_HOOKS) + + +### LOCAL APT RESOURCES +PRAWNOS_LOCAL_APT_REPO := $(PRAWNOS_BUILD)/prawnos-local-apt-repo +PRAWNOS_LOCAL_APT_SOURCE := "deb [trusted=yes] file://$(PRAWNOS_LOCAL_APT_REPO) ./" + +PRAWNOS_LOCAL_APT_VARS := $(PRAWNOS_LOCAL_APT_REPO) $(PRAWNOS_LOCAL_APT_SOURCE) + +### MISC GLOBALS +# Otherwise errors are ignored when output is piped to tee: +SHELL := /bin/bash -o pipefail + +#========================================================================================= +endif # BUILD_COMMON_MK diff --git a/scripts/buildFilesystem.sh b/scripts/BuildScripts/FilesystemScripts/buildFilesystem.sh similarity index 96% rename from scripts/buildFilesystem.sh rename to scripts/BuildScripts/FilesystemScripts/buildFilesystem.sh index f7b0996..a5f6e0d 100755 --- a/scripts/buildFilesystem.sh +++ b/scripts/BuildScripts/FilesystemScripts/buildFilesystem.sh @@ -51,10 +51,17 @@ then echo "No prawnos_root path supplied" exit 1 fi +if [ -z "$5" ] +then + echo "No shared scripts path supplied" + exit 1 +fi + KVER=$1 DEBIAN_SUITE=$2 BASE=$3 PRAWNOS_ROOT=$4 +PRAWNOS_SHARED_SCRIPTS=$5 outmnt=$(mktemp -d -p "$(pwd)") @@ -62,11 +69,9 @@ outdev=/dev/loop5 install_resources=resources/InstallResources build_resources=resources/BuildResources -script_resources=scripts/ -package_lists=$script_resources/package_lists.sh -# Import the package lists -source $package_lists +# Import the package lists, shared scripts +source $PRAWNOS_SHARED_SCRIPTS/* #A hacky way to ensure the loops are properly unmounted and the temp files are properly deleted. @@ -141,7 +146,7 @@ mkdir $outmnt/InstallResources/icons/ cp $build_resources/logo/icons/icon-small.png $outmnt/InstallResources/icons/ cp $build_resources/logo/icons/ascii/* $outmnt/InstallResources/icons/ cp scripts/InstallScripts/* $outmnt/InstallResources/ -cp $package_lists $outmnt/InstallResources/ +cp $PRAWNOS_SHARED_SCRIPTS/package_lists.sh $outmnt/InstallResources/ cp scripts/InstallScripts/InstallPrawnOS.sh $outmnt/ chmod +x $outmnt/*.sh diff --git a/scripts/injectKernelIntoFS.sh b/scripts/BuildScripts/ImageScripts/installKernelToFs.sh similarity index 100% rename from scripts/injectKernelIntoFS.sh rename to scripts/BuildScripts/ImageScripts/installKernelToFs.sh diff --git a/scripts/buildInitramFs.sh b/scripts/BuildScripts/InitramfsScripts/buildInitramFs.sh similarity index 100% rename from scripts/buildInitramFs.sh rename to scripts/BuildScripts/InitramfsScripts/buildInitramFs.sh diff --git a/scripts/LibKernelUpgrade.sh b/scripts/BuildScripts/KernelScripts/LibKernelUpgrade.sh similarity index 100% rename from scripts/LibKernelUpgrade.sh rename to scripts/BuildScripts/KernelScripts/LibKernelUpgrade.sh diff --git a/scripts/buildKernel.sh b/scripts/BuildScripts/KernelScripts/buildKernel.sh similarity index 100% rename from scripts/buildKernel.sh rename to scripts/BuildScripts/KernelScripts/buildKernel.sh diff --git a/scripts/crossmenuconfig.sh b/scripts/BuildScripts/KernelScripts/crossMenuConfig.sh similarity index 100% rename from scripts/crossmenuconfig.sh rename to scripts/BuildScripts/KernelScripts/crossMenuConfig.sh diff --git a/scripts/patchKernel.sh b/scripts/BuildScripts/KernelScripts/patchKernel.sh similarity index 100% rename from scripts/patchKernel.sh rename to scripts/BuildScripts/KernelScripts/patchKernel.sh diff --git a/scripts/PackageScripts/installPackage.sh b/scripts/BuildScripts/PackageScripts/installPackage.sh similarity index 100% rename from scripts/PackageScripts/installPackage.sh rename to scripts/BuildScripts/PackageScripts/installPackage.sh diff --git a/scripts/PackageScripts/pbuildPackage.sh b/scripts/BuildScripts/PackageScripts/pbuildPackage.sh similarity index 100% rename from scripts/PackageScripts/pbuildPackage.sh rename to scripts/BuildScripts/PackageScripts/pbuildPackage.sh diff --git a/scripts/PackageScripts/uploadPackage.sh b/scripts/BuildScripts/PackageScripts/uploadPackage.sh similarity index 100% rename from scripts/PackageScripts/uploadPackage.sh rename to scripts/BuildScripts/PackageScripts/uploadPackage.sh diff --git a/scripts/package_lists.sh b/scripts/Shared/package_lists.sh similarity index 100% rename from scripts/package_lists.sh rename to scripts/Shared/package_lists.sh diff --git a/scripts/common.mk b/scripts/common.mk deleted file mode 100755 index 5ef3a37..0000000 --- a/scripts/common.mk +++ /dev/null @@ -1,27 +0,0 @@ -ifndef COMMON_MK -COMMON_MK := 1 - -#Place all shared make vars below -#========================================================================================= -PRAWNOS_BUILD := $(PRAWNOS_ROOT)/build -PRAWNOS_LOCAL_APT_REPO := $(PRAWNOS_BUILD)/prawnos-local-apt-repo -PRAWNOS_LOCAL_APT_SOURCE := "deb [trusted=yes] file://$(PRAWNOS_LOCAL_APT_REPO) ./" - -PRAWNOS_SCRIPTS := $(PRAWNOS_ROOT)/scripts -PRAWNOS_PACKAGE_SCRIPTS := $(PRAWNOS_SCRIPTS)/PackageScripts -PRAWNOS_PACKAGE_SCRIPTS_INSTALL_PACKAGE := $(PRAWNOS_SCRIPTS)/PackageScripts/installPackage.sh -PRAWNOS_PACKAGE_SCRIPTS_PBUILD_PACKAGE := $(PRAWNOS_SCRIPTS)/PackageScripts/pbuildPackage.sh -PRAWNOS_PACKAGE_SCRIPTS_UPLOAD_PACKAGE := $(PRAWNOS_SCRIPTS)/PackageScripts/uploadPackage.sh - -PBUILDER_DIR := $(PRAWNOS_ROOT)/resources/BuildResources/pbuilder -PBUILDER_CHROOT := $(PRAWNOS_BUILD)/prawnos-pbuilder-armhf-base.tgz -PBUILDER_RC := $(PBUILDER_DIR)/prawnos-pbuilder.rc -PBUILDER_HOOKS := $(PBUILDER_DIR)/hooks - -PBUILDER_VARS := $(PBUILDER_CHROOT) $(PBUILDER_RC) $(PBUILDER_HOOKS) -PRAWNOS_LOCAL_APT_VARS := $(PRAWNOS_LOCAL_APT_REPO) $(PRAWNOS_LOCAL_APT_SOURCE) -# Otherwise errors are ignored when output is piped to tee: -SHELL := /bin/bash -o pipefail - -#========================================================================================= -endif # COMMON_MK