distribution/packages/jelos/package.mk
fewtarius 165f994bc1
* Rework profile bits so they are correctly named and sequenced.
* Drop deprecated device.config from AMD64.
* Add a platform quirk for AMD64.x
2023-09-04 10:46:11 +00:00

96 lines
2.6 KiB
Makefile

# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2020-present Fewtarius
PKG_NAME="jelos"
PKG_VERSION=""
PKG_ARCH="any"
PKG_LICENSE="apache2"
PKG_SITE=""
PKG_URL=""
PKG_DEPENDS_TARGET="toolchain"
PKG_SHORTDESC="JELOS Meta Package"
PKG_LONGDESC="JELOS Meta Package"
PKG_IS_ADDON="no"
PKG_AUTORECONF="no"
PKG_TOOLCHAIN="make"
make_target() {
:
}
makeinstall_target() {
mkdir -p ${INSTALL}/usr/config/
rsync -av ${PKG_DIR}/config/* ${INSTALL}/usr/config/
ln -sf /storage/.config/system ${INSTALL}/system
find ${INSTALL}/usr/config/system/ -type f -exec chmod o+x {} \;
mkdir -p ${INSTALL}/usr/bin/
### Compatibility links for ports
ln -s /storage/roms ${INSTALL}/roms
### Add some quality of life customizations for hardworking devs.
if [ -n "${LOCAL_SSH_KEYS_FILE}" ]
then
mkdir -p ${INSTALL}/usr/config/ssh
cp ${LOCAL_SSH_KEYS_FILE} ${INSTALL}/usr/config/ssh/authorized_keys
fi
if [ -n "${LOCAL_WIFI_SSID}" ]
then
sed -i "s#network.enabled=0#network.enabled=1#g" ${INSTALL}/usr/config/system/configs/system.cfg
cat <<EOF >> ${INSTALL}/usr/config/system/configs/system.cfg
wifi.ssid=${LOCAL_WIFI_SSID}
wifi.key=${LOCAL_WIFI_KEY}
EOF
fi
}
post_install() {
ln -sf jelos.target ${INSTALL}/usr/lib/systemd/system/default.target
if [ ! -d "${INSTALL}/usr/share" ]
then
mkdir "${INSTALL}/usr/share"
fi
cp ${PKG_DIR}/sources/post-update ${INSTALL}/usr/share
chmod 755 ${INSTALL}/usr/share/post-update
# Issue banner
BUILD_ID=$(git rev-parse HEAD)
cp ${PKG_DIR}/sources/issue ${INSTALL}/etc
ln -s /etc/issue ${INSTALL}/etc/motd
cat <<EOF >> ${INSTALL}/etc/issue
==> Version: ${OS_VERSION} (${BUILD_ID:0:7})
==> Built: ${BUILD_DATE}
EOF
cp ${PKG_DIR}/sources/scripts/* ${INSTALL}/usr/bin
chmod 0755 ${INSTALL}/usr/bin/* 2>/dev/null ||:
enable_service jelos-automount.service
### Fix and migrate to autostart package
enable_service jelos-autostart.service
### Take a backup of the system configuration on shutdown
enable_service save-sysconfig.service
sed -i "s#@DEVICENAME@#${DEVICE}#g" ${INSTALL}/usr/config/system/configs/system.cfg
### Defaults for non-main builds.
BUILD_BRANCH="$(git branch --show-current)"
if [[ ! "${BUILD_BRANCH}" =~ main ]]
then
sed -i "s#ssh.enabled=0#ssh.enabled=1#g" ${INSTALL}/usr/config/system/configs/system.cfg
sed -i "s#network.enabled=0#network.enabled=1#g" ${INSTALL}/usr/config/system/configs/system.cfg
fi
### Disable automount on AMD64
if [ "${DEVICE}" = "AMD64" ]
then
sed -i "s#system.automount=1#system.automount=0#g" ${INSTALL}/usr/config/system/configs/system.cfg
fi
}