diff options
author | davidovski <david@davidovski.xyz> | 2022-04-14 22:28:41 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-04-14 22:28:41 +0100 |
commit | 7cc715c1249422ddf91987be64a35eef43e3e62d (patch) | |
tree | fd706e77c0eaec256acf3dc24e781b5fc9f59d09 /auto | |
parent | 734e13526a2ec3ced7f085e444fc9525dfad348b (diff) |
added auto create file
Diffstat (limited to 'auto')
-rwxr-xr-x | auto/create.sh | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/auto/create.sh b/auto/create.sh new file mode 100755 index 0000000..a7f965e --- /dev/null +++ b/auto/create.sh @@ -0,0 +1,75 @@ +#!/bin/sh +read -p "package name> " name +repo=$(ls repo/ | fzf --prompt="repo> ") +read -p "package version> " version +read -p "description> " desc +read -p "source url> " url +deps=$(find repo -type f | xargs -I % basename % .xibuild | fzf -m --prompt="dependencies> ") +read -p "additional urls> " additional +type=$(find ./templates -type f | xargs -I % basename % .xibuild | fzf --prompt="build type> ") + +clear +echo Name: $name +echo Repo: $repo +echo Deps: $deps +echo Desc: $desc +echo Vers: $version +echo Sour: $url +echo Addi: $additional +echo Type: $type +read -p "Ok? " go + +template=./templates/$type.xibuild +buildfile=repo/$repo/$name.xibuild + +[ -f $buildfile ] && read -p "Buildfile already exists, overwrite? " go + +url=$(echo $url | sed "s/$version/\$PKG_VER/g" | sed "s/\$pkgver/\$PKG_VER/g") +makedeps="" + +case $type in + make|configure) + makedeps="make $makedeps" + ;; + meson) + makedeps="meson ninja $makedeps" + ;; +esac + +cat > $buildfile << EOF +#!/bin/sh + +NAME="$name" +DESC="$desc" + +MAKEDEPS="$makedeps" +DEPS="$deps" + +PKG_VER=$version +SOURCE="$url" +EOF + + +[ "${#additional}" = 0 ] || { + filenames="" + mkdir extra/$name + for l in $additional; do + filename=$(basename $l) + curl -SsL $l > extra/$name/$filename + filenames="$filename $filenames" + done + echo "ADDITIONAL=\"$filenames\"" >> $buildfile + + echo $filenames | grep -q ".patch " && { + cat > $buildfile << EOF + +prepare () { + apply_patches +} +EOF + } +} + +echo >> $buildfile +cat $template >> $buildfile +vim $buildfile |