From b2ddc5708691e1ec58445f42ed1bb3dadcf685b5 Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Mon, 20 Dec 2021 09:16:56 -0800 Subject: [PATCH] Add packaging files --- PKGBUILD | 43 ++++++++++++++++++++++++++ file-scripts.rb | 21 +++++++++++++ file-scripts.spec | 77 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 PKGBUILD create mode 100644 file-scripts.rb create mode 100644 file-scripts.spec diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..cce1414 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,43 @@ +# Maintainer: Eric Torres +pkgname=file-scripts +pkgver=0.9.0 +pkgrel=0 +pkgdesc="Various scripts for performing file-related operations such as editing and deleting." +arch=(any) +license=(GPL3) +depends=(fd fzf python) +makedepends=(git) +source=("${pkgname}::git+file:///home/etorres/Projects/file-scripts") +sha256sums=('SKIP') +sha512sums=('SKIP') + +pkgver() { + cd "$srcdir/${pkgname}" + printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')" +} + +package() { + cd "${srcdir}/${pkgname}" + + install -dm755 "${pkgdir}"/usr/{bin,share/zsh/{plugins/helper-scripts,site-functions}} + + for script in *.{py,sh}; do + install -m755 "${script}" "${pkgdir}/usr/bin/${script%.*}" + done + + ## Install /etc/config files + #install -dm755 "${pkgdir}/etc/helper-scripts" + #for config in config/*; do + # install -m644 "${config}" "${pkgdir}/etc/helper-scripts/${config##*/}" + #done + + ## Install zsh completions + #for completion in zsh/completions/*; do + # install -m644 "${completion}" "${pkgdir}/usr/share/zsh/site-functions/${plugin##*.}" + #done + + ## Install zsh plugins + #for plugin in zsh/plugins/*; do + # install -m644 "${plugin}" "${pkgdir}/usr/share/zsh/plugins/helper-scripts/${plugin##*/}" + #done +} diff --git a/file-scripts.rb b/file-scripts.rb new file mode 100644 index 0000000..e564705 --- /dev/null +++ b/file-scripts.rb @@ -0,0 +1,21 @@ +class HelperScripts < Formula + desc "Various scripts for performing file-related operations such as editing and deleting" + homepage "https://github.com/etorres4/helper-scripts" + url "https://github.com/etorres4/file-scripts", + :using => :git + sha256 "7b6c3f363e3b34787765b5975d87f861a19eeda278612cbf8c5176e3e2732cd9" + version "0.9" + + # No build dependencies + bottle :unneeded + + def install + #bin.install "ddusb.py" => "ddusb" + #bin.install "fless.sh" => "fless" + #bin.install "lsgroups.sh" => "lsgroups" + #bin.install "lsusers.sh" => "lsusers" + + # Install completions to zsh/site-functions + zsh_completion.install Dir["zsh/completions/_*"] + end +end diff --git a/file-scripts.spec b/file-scripts.spec new file mode 100644 index 0000000..860b207 --- /dev/null +++ b/file-scripts.spec @@ -0,0 +1,77 @@ +# +# spec file for package file-scripts +# +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: file-scripts +Version: 0.9 +Release: 0 +Summary: Eric's helper scripts +License: GPL-3.0-only +Group: Productivity/File utilities +Source: %{name}-%{version}.tar.gz +Requires: %{_bindir}/python3 +Requires:: fd +Recommends: fzf +Supplements: bash +Supplements: zsh +BuildArch: noarch + +%description +A collection of various helper scripts and some shell completions to speed up terminal workflow. + +%package zsh-plugins +Summary: zsh addons for helper scripts +Requires: %{name} = %{version} +Requires: /bin/zsh + +%description zsh-plugins +Plugins and completions for helper scripts. + +%prep +%setup -q + +%build + +%install +# Install scripts in /usr/bin first +SCRIPTDIR='%{buildroot}%{_bindir}' + +for script in *.{py,sh}; do + install -Dm755 "${script}" "${SCRIPTDIR}/${script%.*}" +done + +# Install zsh plugins +ZSHPLUGINDIR='%{buildroot}%{_datadir}/zsh/plugins/helper-scripts' +mkdir -p "${ZSHPLUGINDIR}" +cp zsh/plugins/* "${ZSHPLUGINDIR}" + +# Install zsh completion functions +ZSHCOMPLETIONDIR="%{buildroot}%{_datadir}/zsh/site-functions" +mkdir -p "${ZSHCOMPLETIONDIR}" + +cp zsh/completions/* "${ZSHCOMPLETIONDIR}" + +%check + +%files +%attr(0755,-,-) %{_bindir}/* + +%files zsh-plugins +%{_datadir}/zsh/plugins/helper-scripts/* +%{_datadir}/zsh/site-functions/* + +%changelog