organize scripts directory, store paths in BuildCommon.mk

This commit is contained in:
Hal Emmerich 2020-06-20 18:44:09 -05:00
parent dbfcc5fcc5
commit ed31f39058
21 changed files with 101 additions and 62 deletions

View File

@ -24,7 +24,7 @@ OUTNAME=PrawnOS-$(PRAWNOS_SUITE)-c201.img
BASE=$(OUTNAME)-BASE BASE=$(OUTNAME)-BASE
PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
include $(PRAWNOS_ROOT)/scripts/common.mk include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
#Usage: #Usage:
@ -98,22 +98,22 @@ build_dirs:
kernel: kernel:
$(MAKE) build_dirs $(MAKE) build_dirs
rm -rf build/logs/kernel-log.txt 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 .PHONY: kernel_config
kernel_config: kernel_config:
scripts/crossmenuconfig.sh $(KVER) $(PRAWNOS_KERNEL_SCRIPTS_MENUCONFIG) $(KVER)
.PHONY: patch_kernel .PHONY: patch_kernel
patch_kernel: patch_kernel:
scripts/patchKernel.sh $(PRAWNOS_KERNEL_SCRIPTS_PATCH)
#:::::::::::::::::::::::::::::: initramfs ::::::::::::::::::::::::::::::::: #:::::::::::::::::::::::::::::: initramfs :::::::::::::::::::::::::::::::::
.PHONY: initramfs .PHONY: initramfs
initramfs: initramfs:
$(MAKE) build_dirs $(MAKE) build_dirs
rm -rf build/logs/initramfs-log.txt 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 :::::::::::::::::::::::::::::::: #:::::::::::::::::::::::::::::: filesystem ::::::::::::::::::::::::::::::::
#makes the base filesystem image without kernel. Only make a new one if the base image isnt present #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 rm -rf build/logs/fs-log.txt
$(MAKE) pbuilder_create $(MAKE) pbuilder_create
$(MAKE) packages $(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 :::::::::::::::::::::::::::::::: #:::::::::::::::::::::::::::::: packages ::::::::::::::::::::::::::::::::
.PHONY: packages .PHONY: packages
@ -140,9 +139,9 @@ endif
#:::::::::::::::::::::::::::::: image management :::::::::::::::::::::::::: #:::::::::::::::::::::::::::::: 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 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 .PHONY: kernel_update
kernel_update: kernel_update:
@ -150,7 +149,7 @@ kernel_update:
$(MAKE) initramfs $(MAKE) initramfs
$(MAKE) kernel $(MAKE) kernel
cp $(BASE) $(OUTNAME) cp $(BASE) $(OUTNAME)
$(MAKE) kernel_inject $(MAKE) kernel_install
.PHONY: image .PHONY: image
image: image:
@ -159,7 +158,7 @@ image:
$(MAKE) initramfs $(MAKE) initramfs
$(MAKE) kernel $(MAKE) kernel
cp $(BASE) $(OUTNAME) cp $(BASE) $(OUTNAME)
$(MAKE) kernel_inject $(MAKE) kernel_install
#:::::::::::::::::::::::::::::: pbuilder management ::::::::::::::::::::::: #:::::::::::::::::::::::::::::: pbuilder management :::::::::::::::::::::::
.PHONY: pbuilder_create .PHONY: pbuilder_create

View File

@ -1,6 +1,6 @@
#import all shared make vars #import all shared make vars
PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
include $(PRAWNOS_ROOT)/scripts/common.mk include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
#package specific vars #package specific vars
VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version) VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version)
@ -10,7 +10,7 @@ PACKAGE_NAME_DEB := $(PACKAGE_NAME).deb
PACKAGE_LOCAL_BUILD_DEPS := PACKAGE_LOCAL_BUILD_DEPS :=
$(PACKAGE_NAME_DEB): $(PACKAGE_NAME_DEB):
$(PRAWNOS_PACKAGE_SCRIPTS_PBUILD_PACKAGE) $(PACKAGE_NAME_DEB) \ $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD) $(PACKAGE_NAME_DEB) \
$(PBUILDER_VARS) \ $(PBUILDER_VARS) \
$(PRAWNOS_LOCAL_APT_VARS) \ $(PRAWNOS_LOCAL_APT_VARS) \
$(PACKAGE_LOCAL_BUILD_DEPS) $(PACKAGE_LOCAL_BUILD_DEPS)
@ -28,8 +28,8 @@ clean:
rm -rf *.buildinfo rm -rf *.buildinfo
install: install:
$(PRAWNOS_PACKAGE_SCRIPTS_INSTALL_PACKAGE) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET)
.PHONY: upload .PHONY: upload
upload: upload:
$(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD_PACKAGE) $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD)

View File

@ -1,6 +1,6 @@
#import all shared make vars #import all shared make vars
PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
include $(PRAWNOS_ROOT)/scripts/common.mk include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
#package specific vars #package specific vars
VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version) VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version)
@ -26,8 +26,8 @@ clean:
rm -rf *.buildinfo rm -rf *.buildinfo
install: install:
$(PRAWNOS_PACKAGE_SCRIPTS_INSTALL_PACKAGE) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET)
.PHONY: upload .PHONY: upload
upload: upload:
$(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD_PACKAGE) $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD)

View File

@ -1,5 +1,5 @@
PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) 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 */) SUBDIRS = $(shell ls -d */)

View File

@ -1,6 +1,6 @@
#import all shared make vars #import all shared make vars
PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
include $(PRAWNOS_ROOT)/scripts/common.mk include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
#package specific vars #package specific vars
VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version) 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_LOCAL_BUILD_DEPS := flashmap
$(PACKAGE_NAME_DEB): $(PACKAGE_NAME_DEB):
$(PRAWNOS_PACKAGE_SCRIPTS_PBUILD_PACKAGE) $(PACKAGE_NAME_DEB) \ $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD) $(PACKAGE_NAME_DEB) \
$(PBUILDER_VARS) \ $(PBUILDER_VARS) \
$(PRAWNOS_LOCAL_APT_VARS) \ $(PRAWNOS_LOCAL_APT_VARS) \
$(PACKAGE_LOCAL_BUILD_DEPS) $(PACKAGE_LOCAL_BUILD_DEPS)
@ -28,8 +28,8 @@ clean:
rm -rf *.buildinfo rm -rf *.buildinfo
install: install:
$(PRAWNOS_PACKAGE_SCRIPTS_INSTALL_PACKAGE) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET)
.PHONY: upload .PHONY: upload
upload: upload:
$(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD_PACKAGE) $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD)

View File

@ -1,6 +1,6 @@
#import all shared make vars #import all shared make vars
PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
include $(PRAWNOS_ROOT)/scripts/common.mk include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
#package specific vars #package specific vars
VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version) VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version)
@ -10,7 +10,7 @@ PACKAGE_NAME_DEB := $(PACKAGE_NAME).deb
PACKAGE_LOCAL_BUILD_DEPS := PACKAGE_LOCAL_BUILD_DEPS :=
$(PACKAGE_NAME_DEB): $(PACKAGE_NAME_DEB):
$(PRAWNOS_PACKAGE_SCRIPTS_PBUILD_PACKAGE) $(PACKAGE_NAME_DEB) \ $(PRAWNOS_PACKAGE_SCRIPTS_PBUILD) $(PACKAGE_NAME_DEB) \
$(PBUILDER_VARS) \ $(PBUILDER_VARS) \
$(PRAWNOS_LOCAL_APT_VARS) \ $(PRAWNOS_LOCAL_APT_VARS) \
$(PACKAGE_LOCAL_BUILD_DEPS) $(PACKAGE_LOCAL_BUILD_DEPS)
@ -28,9 +28,9 @@ clean:
rm -rf *.buildinfo rm -rf *.buildinfo
install: install:
$(PRAWNOS_PACKAGE_SCRIPTS_INSTALL_PACKAGE) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET) $(PRAWNOS_PACKAGE_SCRIPTS_INSTALL) $(PACKAGE_NAME_DEB) $(INSTALL_TARGET)
.PHONY: upload .PHONY: upload
upload: upload:
$(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD_PACKAGE) $(PRAWNOS_PACKAGE_SCRIPTS_UPLOAD)

View File

@ -1,5 +1,5 @@
PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel)
include $(PRAWNOS_ROOT)/scripts/common.mk include $(PRAWNOS_ROOT)/scripts/BuildScripts/BuildCommon.mk
all: all:
@echo TODO @echo TODO

View File

@ -1,5 +1,5 @@
PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) 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 */) SUBDIRS = $(shell ls -d */)
@ -16,7 +16,7 @@ clean:
install: install:
@echo packages install target is $(INSTALL_TARGET) $(info packages install target is $(INSTALL_TARGET))
for dir in $(SUBDIRS) ; do \ for dir in $(SUBDIRS) ; do \
make install INSTALL_TARGET=$(INSTALL_TARGET) -C $$dir ; \ make install INSTALL_TARGET=$(INSTALL_TARGET) -C $$dir ; \
done done

View File

@ -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

View File

@ -51,10 +51,17 @@ then
echo "No prawnos_root path supplied" echo "No prawnos_root path supplied"
exit 1 exit 1
fi fi
if [ -z "$5" ]
then
echo "No shared scripts path supplied"
exit 1
fi
KVER=$1 KVER=$1
DEBIAN_SUITE=$2 DEBIAN_SUITE=$2
BASE=$3 BASE=$3
PRAWNOS_ROOT=$4 PRAWNOS_ROOT=$4
PRAWNOS_SHARED_SCRIPTS=$5
outmnt=$(mktemp -d -p "$(pwd)") outmnt=$(mktemp -d -p "$(pwd)")
@ -62,11 +69,9 @@ outdev=/dev/loop5
install_resources=resources/InstallResources install_resources=resources/InstallResources
build_resources=resources/BuildResources build_resources=resources/BuildResources
script_resources=scripts/
package_lists=$script_resources/package_lists.sh
# Import the package lists # Import the package lists, shared scripts
source $package_lists source $PRAWNOS_SHARED_SCRIPTS/*
#A hacky way to ensure the loops are properly unmounted and the temp files are properly deleted. #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/icon-small.png $outmnt/InstallResources/icons/
cp $build_resources/logo/icons/ascii/* $outmnt/InstallResources/icons/ cp $build_resources/logo/icons/ascii/* $outmnt/InstallResources/icons/
cp scripts/InstallScripts/* $outmnt/InstallResources/ 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/ cp scripts/InstallScripts/InstallPrawnOS.sh $outmnt/
chmod +x $outmnt/*.sh chmod +x $outmnt/*.sh

View File

@ -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