#!/bin/sh set -eu PPT_VERSION='@PPT_VERSION@' PLATFORM= MAINTAINER_NAME= MAINTAINER_MAILBOX= main() { local date= while [ "x${PLATFORM}" = 'x' ]; do prompt 'Platform' PLATFORM if [ "x${PLATFORM#*[^a-z0-9-]}" != "x${PLATFORM}" ]; then printf 'Error: Platform name may consist only of %s\n' \ 'lowercase Latin letters, digits, and hypens' \ >&2 PLATFORM='' fi done prompt 'Maintainer name' MAINTAINER_NAME prompt 'Maintainer e-mail address' MAINTAINER_MAILBOX if [ "x${MAINTAINER_NAME#\"}" = "x${MAINTAINER_NAME}" ]; then if [ "x${MAINTAINER_NAME#*[()<>\[\]:;@\\,.]}" != \ "x${MAINTAINER_NAME}" ]; then MAINTAINER_NAME="\"${MAINTAINER_NAME}\"" fi fi if [ "x${MAINTAINER_MAILBOX#<}" = "x${MAINTAINER_MAILBOX}" ]; then MAINTAINER_MAILBOX="<${MAINTAINER_MAILBOX}>" fi date="$(LC_ALL='POSIX' date '+%a, %d %b %Y %H:%M:%S %z')" printf '2.0\n' >format cat >control <<-EOF Maintainer: ${MAINTAINER_NAME} ${MAINTAINER_MAILBOX} Build-Depends: opkbuild (>= 4.2.1-3), platconf-pkg-tools (>= ${PPT_VERSION%.*}), EOF cat >changelog <<-EOF config-${PLATFORM} (1) trunk * Initial release. -- ${MAINTAINER_NAME} ${MAINTAINER_MAILBOX} ${date} EOF mkdir src src/build src/run cat >build <<-EOF #!/usr/bin/make -f include /usr/share/platconf-pkg-tools/build.mk EOF chmod 0755 build printf 'ppt_version=%d\n' ${PPT_VERSION%%.*} >ppt-version >copyright cat <<-EOF Package generated. Put build-time configuration files in either src/build/_ or src/build/, e.g.: src/build/busybox_1.30.1/config src/build/linux-libre-4.19/config Put run-time configuration files in src/run/, e.g.: src/run/lilo/etc/lilo.conf.in Then run ppt-mkpkgs to generate metadata files for binary packages. EOF } prompt() { local msg="${1}" local var="${2}" printf '%s:\n> ' "${msg}" read -r "${var}" } main "${@}"