102 lines
2.3 KiB
Bash
Executable File
102 lines
2.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
|
|
# This file is part of scripts.
|
|
|
|
# scripts is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, version 3.
|
|
|
|
# scripts is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
# Original author: Maciej Barć <xgqt@riseup.net>
|
|
# Copyright (c) 2020, src_prepare group
|
|
# Licensed under the GNU GPL v3 License
|
|
|
|
# shellcheck disable=2016
|
|
|
|
|
|
trap 'exit 128' INT
|
|
export PATH
|
|
|
|
|
|
ebuild_template='# Copyright 1999-2021 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>
|
|
<maintainer type=\"person\">
|
|
<email>$(git config --get user.email)</email>
|
|
<name>$(git config --get user.name)</name>
|
|
</maintainer>
|
|
<longdescription lang=\"en\">
|
|
CHANGEME
|
|
</longdescription>
|
|
<upstream>
|
|
<remote-id type=\"CHANGEME\">CHANGEME</remote-id>
|
|
</upstream>
|
|
</pkgmetadata>"
|
|
|
|
|
|
main() {
|
|
ebuild="$(basename "$(pwd)")-9999.ebuild"
|
|
if [ ! -f "${ebuild}" ]
|
|
then
|
|
printf "%s\n" "${ebuild_template}" > "${ebuild}"
|
|
else
|
|
printf "%s\n" "Already exists: ${ebuild}" >> /dev/stderr
|
|
fi
|
|
if [ ! -f "metadata.xml" ]
|
|
then
|
|
printf "%s\n" "${metadata_template}" > "metadata.xml"
|
|
else
|
|
printf "%s\n" "Already exists: metadata.xml" >> /dev/stderr
|
|
fi
|
|
}
|
|
|
|
|
|
if [ -f ../../profiles/repo_name ]
|
|
then
|
|
main
|
|
else
|
|
printf "%s\n" \
|
|
"Are you in a overlay repo?" \
|
|
"To use this script successfully:" \
|
|
"1. Create a \${CATEGOTY}/\${PN} directory" \
|
|
"2. Change directory to it" \
|
|
"3. Execute ${0}" >> /dev/stderr
|
|
exit 1
|
|
fi
|