mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-15 00:05:11 +02:00
Add plugins support 4 snapcraft (#512)
* Added `snap` support. * Added plugins support. * Add README 4 snap. --------- Co-authored-by: Kelly Brazil <kellyjonbrazil@gmail.com>
This commit is contained in:
75
README-snap.md
Normal file
75
README-snap.md
Normal file
@ -0,0 +1,75 @@
|
||||
# How to use `jc` with `snap`
|
||||
|
||||
## How to build `snap` package
|
||||
|
||||
- Install `snapd`. [One](https://snapcraft.io/docs/installing-snapd) or [two](https://github.com/don-rumata/ansible-role-install-snap).
|
||||
|
||||
- Install `snapcraft`:
|
||||
|
||||
```bash
|
||||
$ sudo snap install snapcraft --classic
|
||||
```
|
||||
|
||||
- Update snapd:
|
||||
|
||||
```bash
|
||||
$ sudo snap refresh snapcraft --edge
|
||||
```
|
||||
|
||||
- Clone the repo:
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/kellyjonbrazil/jc
|
||||
```
|
||||
|
||||
- Change the directory:
|
||||
|
||||
```bash
|
||||
$ cd ./jc
|
||||
```
|
||||
|
||||
- Select branch:
|
||||
|
||||
```bash
|
||||
$ git checkout snap-support
|
||||
```
|
||||
|
||||
- Initialize LXD:
|
||||
|
||||
```bash
|
||||
$ lxd init --auto
|
||||
```
|
||||
|
||||
- Build `.snap` file:
|
||||
|
||||
```bash
|
||||
$ snapcraft
|
||||
```
|
||||
|
||||
## How to install local snap file
|
||||
|
||||
```bash
|
||||
$ snap install --dangerous ./jc_*_amd64.snap
|
||||
```
|
||||
|
||||
## How to use `jc` with plugins
|
||||
|
||||
- Put your plugin in the `"$HOME/.local/share/jc"` directory.
|
||||
|
||||
- To connect the directory, run:
|
||||
|
||||
```bash
|
||||
snap connect jc:dot-jc-plugins snapd
|
||||
```
|
||||
|
||||
## Urls
|
||||
|
||||
- <https://snapcraft.io/docs/supported-interfaces>
|
||||
|
||||
- <https://snapcraft.io/docs/interface-management>
|
||||
|
||||
- <https://snapcraft.io/docs/personal-files-interface>
|
||||
|
||||
- <https://snapcraft.io/docs/python-apps>
|
||||
|
||||
- <https://documentation.ubuntu.com/lxd/en/latest/getting_started/>
|
13
snap/local/jc-launcher.sh
Executable file
13
snap/local/jc-launcher.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH_TO_JC="$SNAP/bin/jc"
|
||||
|
||||
# Don't work. I don't know why.
|
||||
# if [ -w "$SNAP_REAL_HOME/.local/share/jc" ] ; then
|
||||
|
||||
if ls "$SNAP_REAL_HOME/.local/share/jc" 1>/dev/null 2>/dev/null
|
||||
then
|
||||
HOME="$SNAP_REAL_HOME" "$PATH_TO_JC" "$@";
|
||||
else
|
||||
"$PATH_TO_JC" "$@";
|
||||
fi
|
58
snap/snapcraft.yaml
Normal file
58
snap/snapcraft.yaml
Normal file
@ -0,0 +1,58 @@
|
||||
---
|
||||
name: jc
|
||||
title: Convert command output to json
|
||||
summary: CLI tool that converts the output command-line tools to JSON
|
||||
description: |
|
||||
CLI tool and python library that converts the output of popular command-line
|
||||
tools, file-types, and common strings to JSON, YAML, or Dictionaries.
|
||||
This allows piping of output to tools like jq and simplifying automation scripts.
|
||||
|
||||
How to use `jc` with plugins:
|
||||
1. Put your plugin in the "$HOME/.local/share/jc" directory.
|
||||
2. Run for `snap connect jc:dot-jc-plugins snapd` connect the directory.
|
||||
# version: git
|
||||
base: core22
|
||||
confinement: strict
|
||||
license: MIT
|
||||
type: app
|
||||
|
||||
website: https://github.com/kellyjonbrazil/jc
|
||||
contact: Kelly Brazil <kellyjonbrazil@gmail.com>
|
||||
source-code: https://github.com/kellyjonbrazil/jc
|
||||
issues: https://github.com/kellyjonbrazil/jc/issues
|
||||
|
||||
adopt-info: jc
|
||||
|
||||
parts:
|
||||
launcher:
|
||||
plugin: dump
|
||||
source: snap/local
|
||||
organize:
|
||||
jc-launcher.sh: bin/
|
||||
|
||||
jc:
|
||||
plugin: python
|
||||
source: .
|
||||
# pulled v1.17.2, `git describe`
|
||||
# source: https://github.com/kellyjonbrazil/jc
|
||||
override-pull: |
|
||||
craftctl default
|
||||
JC_VERSION=$(grep version= setup.py | cut -d '=' -f 2 | sed "s/,$// ; s/'//g")
|
||||
craftctl set version=$JC_VERSION
|
||||
craftctl set grade="stable"
|
||||
|
||||
plugs:
|
||||
dot-jc-plugins:
|
||||
interface: personal-files
|
||||
read:
|
||||
- $HOME/.local
|
||||
- $HOME/.local/share
|
||||
|
||||
apps:
|
||||
jc:
|
||||
command: bin/jc-launcher.sh
|
||||
environment:
|
||||
LC_ALL: C.UTF-8
|
||||
plugs:
|
||||
- home
|
||||
- dot-jc-plugins
|
Reference in New Issue
Block a user