14 Commits

Author SHA1 Message Date
48bfbd0a15 use release tag 2023-09-03 20:38:05 +02:00
e2d0f220e4 help and usage on how to start with s3h 2023-09-03 20:30:04 +02:00
dad2a0a902 group specific options
.options file can be added into group folder to
add ssh options for every file inside this group folder
2023-09-03 20:18:15 +02:00
04215f8320 deb build file uses offical s3h.sh file
TODO: should be loaded from tag
2023-08-27 21:51:17 +02:00
76c9e4949c I am an idiot
And yes, the token was deleleted and recreated m(
2023-08-27 21:49:08 +02:00
cad3690da3 show selected config (was cleared prior) 2023-08-27 21:44:51 +02:00
8429669cdc deb build script 2023-08-27 21:44:14 +02:00
4aa1631e50 clear screen before connect 2023-08-24 22:14:49 +02:00
6887350ce8 standard start directory 2023-08-24 22:13:52 +02:00
c4e5ed1900 Merge branch 'main' of ssh://source.devloop.de:2222/damage/s3h 2023-08-23 23:51:54 +02:00
bb0086e5ac screenshot added 2023-08-23 23:51:40 +02:00
524823ed53 README.md aktualisiert 2023-08-23 23:45:54 +02:00
20dbd1ed62 README + additional sample 2023-08-23 23:44:45 +02:00
b17b19c0c0 rename shell script 2023-08-23 23:40:56 +02:00
10 changed files with 85 additions and 6 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
build/credentials
build/deb/*.deb

11
README.md Normal file
View File

@ -0,0 +1,11 @@
# S3H
Select a ssh config file which will be used to connect to a host via - you guessed it - ssh. The content of the config file is _NOT_ like `ssh_config`. The content will be read by line and every line will be added as parameter to the ssh command. So you can use your global and/or user defined `ssh_config` and still add options.
![Screenshot](screenshot.png)
## Usage
```
./s3h.sh <start directory>
```
Sample structure of `start directory` can be found in `test`.

View File

@ -0,0 +1,2 @@
GITEA_USER=user
GITEA_PASS=pass or token

37
build/deb/build_stable.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
NAME=s3h
VERSION=1.2
REVISION=1
ARCH=all
curdir=`dirname $0`
workdir="$curdir/${NAME}_${VERSION}-${REVISION}_${ARCH}"
mkdir -p "$workdir"
mkdir -p "$workdir/usr/bin"
wget -O "$workdir/usr/bin/s3h" "https://source.devloop.de/damage/s3h/raw/tag/$VERSION/s3h.sh"
chmod 0777 "$workdir/usr/bin/s3h"
mkdir "$workdir/DEBIAN"
cat << EOT > "$workdir/DEBIAN/control"
Package: $NAME
Version: $VERSION
Architecture: $ARCH
Maintainer: Daniel Buschke <damage@devloop.de>
Description: SSH Session Manager for CLI
s3h is a SSH Session Manager which is completly running on cli.
Homepage: https://source.devloop.de/damage/s3h
Depends: dialog
EOT
dpkg-deb --build --root-owner-group "$workdir"
if [[ $? -eq 0 ]]; then
source "$curdir/../credentials"
curl --user "$GITEA_USER:$GITEA_PASS" \
--upload-file "${NAME}_${VERSION}-${REVISION}_${ARCH}.deb" \
https://source.devloop.de/api/packages/damage/debian/pool/stable/main/upload
rm -rf "$workdir"
fi

View File

@ -2,12 +2,19 @@
# config
DIALOG=dialog #gdialog kdialog
START_DIR=''
START_DIR='~/.s3h'
if [[ $# -eq 1 && -d "$1" ]]; then
START_DIR="$1"
fi
if [[ ! -d "$START_DIR" ]]; then
echo "start directory '$START_DIR' does not exist" >&2
echo -e "either create or set 'start directory' parameter\n" >&2
echo "Usage: $0 [start directory]" >&2
exit 2
fi
# select config file
configFile=''
while [[ -z "$configFile" ]]; do
@ -24,14 +31,24 @@ while [[ -z "$configFile" ]]; do
fi
# add directory selectors
for d in `find $dir -mindepth 1 -maxdepth 1 -type d -printf "%f\n" |sort`; do
dirs=`find $dir -mindepth 1 -maxdepth 1 ! -name '.*' -type d -printf "%f\n" |sort`
for d in $dirs; do
para+=("$d" "<$d>")
done
# add file selectors
for d in `find $dir -mindepth 1 -maxdepth 1 -type f -printf "%f\n" |sort`; do
files=`find $dir -mindepth 1 -maxdepth 1 ! -name '.*' -type f -printf "%f\n" |sort`
for d in $files; do
para+=("$d" "$d")
done
if [[ ${#para[@]} -eq 0 ]]; then
echo "no file or directory found in '$dir'" >&2
echo "either create a connection file like" >&2
echo -e "\ttouch '$dir/root@example.org'" >&2
echo "or create a group by adding a directory" >&2
exit 3
fi
# run dialog
ret=$("$DIALOG" --no-tags --stdout --menu "select connection" 0 0 0 ${para[@]} 2>&1)
if [[ $? -ne 0 ]]; then
@ -51,16 +68,26 @@ while [[ -z "$configFile" ]]; do
fi
done
echo "config file '$configFile' selected. connecting..."
# read config file and connect
if [[ -f "$configFile" ]]; then
clear
# each line equals one config option
para=()
while read -r configLine; do
para+=($configLine)
done < "$configFile"
# lookup group specific option file
if [[ -f "$dir/.options" ]]; then
while read -r configLine; do
para+=($configLine)
done < "$dir/.options"
echo "using group options file '$dir/.options'"
fi
# clear screen // remove dialog colors
echo "config file '$configFile' selected. connecting..."
# execute ssh
ssh ${para[@]} `basename "$configFile"`
fi

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1 +1 @@
-l root
-l foobar

View File

View File

0
test/foobar@devloop.de Normal file
View File