From d8173211cf180eb18c63b53566f259b421ac48fd Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley Date: Tue, 22 May 2018 21:59:36 +0100 Subject: [PATCH 1/3] Add snap support This patch adds a snapcraft.yaml file to allow xsos to be built installed and run as a snap (see https://snapcraft.io/ for more info). Also makes a couple of minor code changes to ensure the snap environment is respected when the snap binary is run. --- snap/snapcraft.yaml | 40 ++++++++++++++++++++++++++++++++++++++++ snap/wrappers/xsos | 6 ++++++ xsos | 5 ++++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 snap/snapcraft.yaml create mode 100755 snap/wrappers/xsos diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 0000000..78849f7 --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,40 @@ +name: xsos +version: "1.0" +summary: Summarize system info from sosreports +description: + The goal of xsos is to make it easy to instantaneously gather information + about a system together in an easy-to-read-summary, whether that system is the + localhost on which xsos is being run or a system for which you have an unpacked + sosreport. + . + There is tons of useful amazing instructive data available to normal users (not + to mention root) on a Linux system, but by design, this information is spread + out across myriad files. Some of it even requires commands to parse through. + . + xsos will attempt to make it easy, parsing and calculating and formatting data + from dozens of files (and commands) to give you a detailed overview about a + system, or -- if requested -- xsos will only parse one file (e.g. with --mem or + --cpu) or output from one command (e.g. with --ip or --ps). + . + New features are being added all the time -- see the tracker to have a look at + some of the things that are already in line to be worked on. +confinement: strict +grade: stable + +apps: + xsos: + command: wrappers/xsos + plugs: [home] +parts: + xsos: + source: . + plugin: dump + stage-packages: [bsdmainutils, coreutils, locales-all] + wrappers: + source: snap/ + plugin: dump + stage-packages: [locales-all] + build-packages: + - lsb-release + after: + - xsos diff --git a/snap/wrappers/xsos b/snap/wrappers/xsos new file mode 100755 index 0000000..78f0cd9 --- /dev/null +++ b/snap/wrappers/xsos @@ -0,0 +1,6 @@ +#!/bin/bash -eu +export LOCPATH=$SNAP_USER_DATA +export LC_ALL=C.UTF-8 +export LANG=en_GB.UTF-8 +export LANGUAGE=en_GB:en +exec "$SNAP/xsos" "$@" diff --git a/xsos b/xsos index 2abcb34..0604056 100755 --- a/xsos +++ b/xsos @@ -16,7 +16,7 @@ #------------------------------------------------------------------------------- # See https://github.com/ryran/xsos/issues/208 -export LC_ALL=en_US.UTF-8 +export LC_ALL=${LC_ALL:-en_US.UTF-8} # Get version from line #2 version=$(sed '2q;d' $0) @@ -3932,8 +3932,11 @@ COND_RUN() { # Create sub tempdir in /dev/shm (tons of bash constructs use TMPDIR) +export TMPDIR=${TMPDIR:-""} +if [ -z '$TMPDIR' ]; then [[ -d /dev/shm && -w /dev/shm ]] && parent=/dev/shm || parent=/tmp export TMPDIR=$(mktemp -d -p $parent) +fi # Create tmp file for capturing stderr stderr_file=$TMPDIR/stderr # Remove temp dir when we're done From 740e1ba10b985f4ef267ce0c8f463faa2ea174b1 Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley Date: Thu, 19 Sep 2019 17:23:49 +0200 Subject: [PATCH 2/3] Add snap removable-media interface and rebase from master --- snap/snapcraft.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 78849f7..5f7d8b8 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: xsos -version: "1.0" +version: "1.1" summary: Summarize system info from sosreports description: The goal of xsos is to make it easy to instantaneously gather information @@ -24,7 +24,7 @@ grade: stable apps: xsos: command: wrappers/xsos - plugs: [home] + plugs: [home, removable-media] parts: xsos: source: . From 02e1ae601192413a6e568a184282a0899fdebdd1 Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley Date: Sun, 29 Dec 2019 18:53:44 +0000 Subject: [PATCH 3/3] Build snap with latest version of xsos Bump version to 0.7.28 and add deps. --- snap/snapcraft.yaml | 20 +++++++++----------- snap/wrappers/xsos | 6 ------ 2 files changed, 9 insertions(+), 17 deletions(-) delete mode 100755 snap/wrappers/xsos diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 5f7d8b8..75a2b93 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: xsos -version: "1.1" +version: "0.7.28" summary: Summarize system info from sosreports description: The goal of xsos is to make it easy to instantaneously gather information @@ -20,21 +20,19 @@ description: some of the things that are already in line to be worked on. confinement: strict grade: stable +base: core20 +environment: + LC_ALL: C.UTF-8 + LANG: C.UTF-8 + LOCPATH: $SNAP_USER_DATA apps: xsos: - command: wrappers/xsos + command: xsos plugs: [home, removable-media] parts: xsos: source: . plugin: dump - stage-packages: [bsdmainutils, coreutils, locales-all] - wrappers: - source: snap/ - plugin: dump - stage-packages: [locales-all] - build-packages: - - lsb-release - after: - - xsos + stage-packages: [bsdmainutils, coreutils, locales-all, gawk] + diff --git a/snap/wrappers/xsos b/snap/wrappers/xsos deleted file mode 100755 index 78f0cd9..0000000 --- a/snap/wrappers/xsos +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -eu -export LOCPATH=$SNAP_USER_DATA -export LC_ALL=C.UTF-8 -export LANG=en_GB.UTF-8 -export LANGUAGE=en_GB:en -exec "$SNAP/xsos" "$@"