scripts/src/new-ebuild

73 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# shellcheck disable=2016
trap 'exit 128' INT
export PATH
ebuild_template='# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DESCRIPTION=""
HOMEPAGE=""
if [[ "${PV}" == *9999* ]]; then
inherit git-r3
EGIT_REPO_URI=""
else
SRC_URI=""
KEYWORDS="~amd64"
fi
RESTRICT="
mirror
!test? ( test )
"
LICENSE=""
SLOT="0"
IUSE="test"
BDEPEND=""
DEPEND=""
RDEPEND=""'
metadata_template='<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
</pkgmetadata>'
main() {
ebuild="$(basename "$(pwd)")-9999.ebuild"
if [ ! -f "${ebuild}" ]
then
echo "${ebuild_template}" > "${ebuild}"
else
echo "Already exists: ${ebuild}"
fi
if [ ! -f "metadata.xml" ]
then
echo "${metadata_template}" > "metadata.xml"
else
echo "Already exists: metadata.xml"
fi
}
if [ -f ../../profiles/repo_name ]
then
main
else
echo "Are you in a overlay repo?"
echo "To use this script successfully:"
echo "1. Create a \${CATEGOTY}/\${PN} directory"
echo "2. Change directory to it"
echo "3. Execute ${0}"
exit 1
fi