Skip to content

Commit

Permalink
scripts/create-pc-layer.sh: Added
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniele Rondina committed Aug 2, 2023
1 parent b1d39e4 commit 82e0d99
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions scripts/create-pc-layer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# Author: Daniele Rondina, geaaru@funtoo.org
# Description: Generate or Update the luet-portage-converter layer file of the
# selected layer.
#
# Example:
# $> LAYER_NAME=funtoo-base sh scripts/create-pc-layer.sh

REPO_DIR=$(dirname ${BASH_SOURCE[0]})/..

LAYER_NAME=${LAYER_NAME:-}
PKGLIST=${PKGLIST:-/usr/share/macaroni/layers/${LAYER_NAME}/pkgslist}

LAYER_FILE=${LAYER_FILE:-${REPO_DIR}/portage-converter/layers/${LAYER_NAME}.yaml}

if [ -z "${LAYER_NAME}" ] ; then
echo "Missing LAYER_NAME env"
exit 1
fi

if [ ! -e ${PKGLIST} ] ; then
echo "The file ${PKGLIST} doesn't exist."
exit 1
fi

# Delete current packages list
yq d ${LAYER_FILE} 'packages' -i

echo "packages:" >> ${LAYER_FILE}

pkgs-checker pkglist show -r ${PKGLIST} -j -p -v | \
jq '.packages[] | " - "+ .category + "/" + .name + ":" + .slot' -r | \
sort >> ${LAYER_FILE}

0 comments on commit 82e0d99

Please sign in to comment.