Merge pull request #63 from Augustin-FL/pr_fix_build_script

Use public PR on pfSense project
This commit is contained in:
Augustin FL 2024-12-12 09:57:34 +01:00 committed by GitHub
commit 8508530186
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 150 deletions

View File

@ -27,28 +27,23 @@ You will also need to apply the following changes:
### FreeBSD Ports
- Checkout to the the branch you would like to build (`devel` for dev version, `RELENG_2_7_2` for stable version).
- Edit the file `/sysutils/pfSense-upgrade/Makefile`: remove the line `RUN_DEPENDS+= pfSense-repoc>=0:sysutils/pfSense-repoc`.
- Edit the file `/sysutils/pfSense-repo/Makefile` : change the line `MIRROR_TYPE?= srv` by `MIRROR_TYPE?= none`.
- Edit the file `/security/pfSense/pkg-plist`: Remove all lines starting with `%%DATADIR%%/keys`.
- Edit the file `/security/pfSense/Makefile`:
- Rename the variable `USE_GITLAB` to `USE_GITHUB`.
- Rename the variable `GL_ACCOUNT` to `GH_ACCOUNT`. Also, change the variable content to your actual GitHub username.
- Rename the variable `GL_COMMIT` to `GH_TAGNAME`.
- Change the line `GL_PROJECT= ${PFSENSE_SRC_REPO}` to `GH_PROJECT= pfsense`.
- Remove the line `GL_SITE= https://gitlab.netgate.com`.
- Remove the line `pfSense-gnid>=0:security/pfSense-gnid \` from the `RUN_DEPENDS` variable, if it exists.
### pfSense GUI
- Checkout to the branch you would like to build (`master` for dev version, `RELENG_2_7_2` for stable version).
- Go to the folder `/tools/templates/pkg_repos/` and rename the file `pfSense-repo.conf` to `libreSense-repo.conf` (if you are building a stable ISO) or `libreSense-repo-devel.conf` (if you are building a dev version).
- Go to the folder `/tools/templates/pkg_repos/` and rename the file `pfSense-repo.conf` to `libreSense-repo.conf`
- Edit the file `/src/etc/inc/globals.inc` : replace the content of `product_name` by `libreSense`, and the content of `pkg_prefix` by `libreSense-pkg-`.
- In the folder `/src/usr/local/share/`, rename the folder `pfSense` to `libreSense`.
- In the folder `/src/etc/`, rename the files `pfSense-ddb.conf` and `pfSense-devd.conf` to `libreSense-ddb.conf` and `libreSense-devd.conf`.
- Edit the file `/tools/templates/core_pkg/base/pkg-plist`: Remove the line `share/%%PRODUCT_NAME%%/initial.txz` from the file.
- Edit the file `/tools/builder_common.sh`: apply the [following patches](https://github.com/Augustin-FL/building-pfsense-iso-from-source/blob/master/patches/builder-common.sh.diff) to the file.
- Edit the file `/tools/builder_defaults.sh`:
- Remove`drm2` and `ndis` from the variable `MODULES_OVERRIDE_amd64`.
- Change variable `PKG_REPO_BRANCH_RELEASE` to `v2_7_2`.
- If you are building a stable version, change variable `PFSENSE_DEFAULT_REPO` to `"${PRODUCT_NAME}-repo"`.
- Edit the file `/tools/builder_common.sh` and `/tools/builder_defaults.sh`: apply the [following pull request](https://github.com/pfsense/pfsense/pull/4721) ([see how](https://www.andrewkroh.com/development/2018/01/17/testing-github-pull-requests-using-git-patches.html)).
- Edit the file `/tools/builder_defaults.sh`: Remove`drm2` and `ndis` from the variable `MODULES_OVERRIDE_amd64`.
## A deeper look into Netgate build environment
@ -99,6 +94,7 @@ pkg install -y git nginx poudriere-devel rsync sudo
pkg install -y vmdktool curl qemu-user-static gtar xmlstarlet pkgconf openssl portsnap
# Required for building iso
mkdir -p /var/db/portsnap
portsnap fetch extract
# not required but advised for building/monitoring/debugging
@ -154,7 +150,7 @@ cd /root/sign/
openssl genrsa -out repo.key 2048
chmod 0400 repo.key
openssl rsa -in repo.key -out repo.pub -pubout
printf "function: sha256\nfingerprint: `sha256 -q repo.pub`\n" > fingerprint
printf "function: sha256\nfingerprint: \"$(sha256 -q repo.pub)\"\n" > fingerprint
curl -o /root/sign/sign.sh https://raw.githubusercontent.com/freebsd/pkg/master/scripts/sign.sh
sed -i "" 's+ repo\.+ /root/sign/repo\.+g' /root/sign/sign.sh
chmod +x /root/sign/sign.sh
@ -204,7 +200,12 @@ export PKG_REPO_SERVER_RELEASE="http://${myIPAddress}/packages"
export PKG_REPO_SERVER_STAGING="http://${myIPAddress}/packages" # We need to also specify this variable, because even
# if we don't build staging release some ports configuration is made for staging
export SRCCONF="/root/pfsense/tmp/FreeBSD-src/release/conf/${PRODUCT_NAME}_build_src.conf"
# pkg repository type. Keep this to none unless you want to set SRV records for your PKG server
export MIRROR_TYPE="none"
# Lowercase name of your repository on git
export POUDRIERE_PFSENSE_SRC_REPO=$(git config --get remote.origin.url|sed 's/.*\/\(.*\)\.git/\1/g'|tr '[:upper:]' '[:lower:]')
```
# Building the ISO

View File

@ -1,140 +0,0 @@
diff --git a/tools/builder_common.sh b/tools/builder_common.sh
index 6280c31460..343daf49ad 100644
--- a/tools/builder_common.sh
+++ b/tools/builder_common.sh
@@ -622,9 +622,8 @@ clone_to_staging_area() {
-X ${_exclude_files} \
.
- core_pkg_create rc "" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR}
+ core_pkg_create boot "" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR} "./boot"
core_pkg_create base "" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR}
- core_pkg_create default-config "" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR}
local DEFAULTCONF=${STAGE_CHROOT_DIR}/conf.default/config.xml
@@ -635,7 +634,6 @@ clone_to_staging_area() {
# Change default interface names to match vmware driver
xml ed -P -L -u "${XML_ROOTOBJ}/interfaces/wan/if" -v "vmx0" ${DEFAULTCONF}
xml ed -P -L -u "${XML_ROOTOBJ}/interfaces/lan/if" -v "vmx1" ${DEFAULTCONF}
- core_pkg_create default-config "vmware" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR}
# Restore default values to be used by serial package
xml ed -P -L -u "${XML_ROOTOBJ}/interfaces/wan/if" -v "${_old_wan_if}" ${DEFAULTCONF}
@@ -650,8 +648,6 @@ clone_to_staging_area() {
echo force > ${STAGE_CHROOT_DIR}/cf/conf/enableserial_force
- core_pkg_create default-config-serial "" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR}
- core_pkg_create default-config "bhyve" ${CORE_PKG_VERSION} ${STAGE_CHROOT_DIR}
rm -f ${STAGE_CHROOT_DIR}/cf/conf/enableserial_force
rm -f ${STAGE_CHROOT_DIR}/cf/conf/config.xml
@@ -714,11 +710,11 @@ customize_stagearea_for_image() {
# Prepare final stage area
create_final_staging_area
- pkg_chroot_add ${FINAL_CHROOT_DIR} rc
+ pkg_chroot_add ${FINAL_CHROOT_DIR} boot
pkg_chroot_add ${FINAL_CHROOT_DIR} base
# Set base/rc pkgs as vital to avoid user end up removing it for any reason
- pkg_chroot ${FINAL_CHROOT_DIR} set -v 1 -y $(get_pkg_name rc)
+ pkg_chroot ${FINAL_CHROOT_DIR} set -v 1 -y $(get_pkg_name boot)
pkg_chroot ${FINAL_CHROOT_DIR} set -v 1 -y $(get_pkg_name base)
if [ "${_image_type}" = "iso" -o \
@@ -729,7 +725,6 @@ customize_stagearea_for_image() {
cp ${CORE_PKG_ALL_PATH}/*default-config*.txz ${FINAL_CHROOT_DIR}/pkgs
fi
- pkg_chroot_add ${FINAL_CHROOT_DIR} ${_default_config}
# XXX: Workaround to avoid pkg to complain regarding release
# repo on first boot since packages are installed from
@@ -1008,7 +1003,7 @@ setup_pkg_repo() {
local _target_arch="${4}"
local _staging="${5}"
local _pkg_conf="${6}"
- local _mirror_type="srv"
+ local _mirror_type="none"
local _signature_type="fingerprints"
if [ -z "${_template}" -o ! -f "${_template}" ]; then
@@ -1032,6 +1027,8 @@ setup_pkg_repo() {
sed \
-e "s/%%ARCH%%/${_target_arch}/" \
+ -e "s/%%OSVERSION%%/${POUDRIERE_BRANCH}/" \
+ -e "s/%%VERSION%%/${POUDRIERE_PORTS_BRANCH}/" \
-e "s/%%MIRROR_TYPE%%/${_mirror_type}/" \
-e "s/%%PKG_REPO_BRANCH_DEVEL%%/${_pkg_repo_branch_devel}/g" \
-e "s/%%PKG_REPO_BRANCH_RELEASE%%/${_pkg_repo_branch_release}/g" \
@@ -1184,7 +1181,7 @@ pkg_chroot_add() {
fi
local _target="${1}"
- local _pkg="$(get_pkg_name ${2}).txz"
+ local _pkg="$(get_pkg_name ${2}).pkg"
if [ ! -d "${_target}" ]; then
echo ">>> ERROR: Target dir ${_target} not found"
@@ -1240,6 +1237,7 @@ install_pkg_install_ports() {
echo "Failed!"
print_error_pfS
fi
+ pkg_chroot ${STAGE_CHROOT_DIR} install "${PRODUCT_NAME}-default-config"
# Make sure required packages are set as non-automatic
pkg_chroot ${STAGE_CHROOT_DIR} set -A 0 pkg ${MAIN_PKG} ${custom_package_list}
# pkg and MAIN_PKG are vital
@@ -1568,7 +1566,13 @@ poudriere_rename_ports() {
cp -r ${d} ${_pdir}/${_pname}
- if [ -f ${_pdir}/${_pname}/pkg-plist ]; then
+ # Composer module is special
+ if echo "${_pname}" | grep -q "composer"; then
+ sed -i '' -e "s,pfSense-composer-deps,${PRODUCT_NAME}-composer-deps,g" \
+ ${_pdir}/${_pname}/Makefile ${_pdescr} ${_plist}
+ continue
+ fi
+ if [ -f ${_pdir}/${_pname}/pkg-plist ] && [ "${_pname}" != "${PRODUCT_NAME}" ]; then
_plist=${_pdir}/${_pname}/pkg-plist
fi
@@ -1576,6 +1580,12 @@ poudriere_rename_ports() {
_pdescr=${_pdir}/${_pname}/pkg-descr
fi
+ # main package is special
+ if [ "${_pname}" == "${PRODUCT_NAME}" ]; then
+ sed -i '' -e "s,pfSense-devd,${PRODUCT_NAME}-devd,g" \
+ -e "s,pfSense-ddb,${PRODUCT_NAME}-ddb,g" \
+ ${_pdir}/${_pname}/pkg-plist
+ fi
sed -i '' -e "s,pfSense,${PRODUCT_NAME},g" \
-e "s,https://www.pfsense.org,${PRODUCT_URL},g" \
-e "/^MAINTAINER=/ s,^.*$,MAINTAINER= ${PRODUCT_EMAIL}," \
@@ -1593,10 +1603,12 @@ poudriere_rename_ports() {
sed -i '' -e "s,COMPILE_DL_PFSENSE,COMPILE_DL_${_product_capital}," \
-e "s,pfSense_module_entry,${PRODUCT_NAME}_module_entry,g" \
-e "s,php_pfSense.h,php_${PRODUCT_NAME}\.h,g" \
+ -e "s,pfSense_arginfo.h,${PRODUCT_NAME}_arginfo\.h,g" \
+ -e "s,pfSense_private.h,${PRODUCT_NAME}_private\.h,g" \
-e "/ZEND_GET_MODULE/ s,pfSense,${PRODUCT_NAME}," \
-e "/PHP_PFSENSE_WORLD_EXTNAME/ s,pfSense,${PRODUCT_NAME}," \
${_pdir}/${_pname}/files/pfSense.c \
- ${_pdir}/${_pname}/files/dummynet.c \
+ ${_pdir}/${_pname}/files/pfSense_private.h \
${_pdir}/${_pname}/files/php_pfSense.h
fi
@@ -2038,6 +2050,8 @@ POUDRIERE_PORTS_NAME=${POUDRIERE_PORTS_NAME}
PFSENSE_DEFAULT_REPO=${PFSENSE_DEFAULT_REPO}
PRODUCT_NAME=${PRODUCT_NAME}
REPO_BRANCH_PREFIX=${REPO_PATH_PREFIX}
+PFSENSE_COMMITHASH=$(git -C ${BUILDER_ROOT} log -1 --format='%H')
+PFSENSE_DATESTRING=${DATESTRING}
EOF
local _value=""