better file names, simplify generate-hosts-sample script
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
rofi-forge-cache-own
|
generate-hosts
|
||||||
|
rofi-config
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
ssh-menu
|
ssh-menu
|
||||||
========
|
========
|
||||||
|
|
||||||
SSH menu using rofi and forging cache file. By default, it will search for host files named after target hosts in `$INFRA/host/` directory.
|
SSH menu using rofi and forging cache file.
|
||||||
|
|
||||||
You can:
|
You can:
|
||||||
- copy `rofi-forge-cache` as `rofi-forge-cache-own` and adapt to your needs
|
- create `generate-hosts` script to forge rofi SSH cache (see generate-hosts-sample)
|
||||||
- copy `rofi-config` as `rofi-config-own` and adapt to your needs
|
- copy `rofi-config-sample` as `rofi-config` and adapt to your needs
|
||||||
- install with `./install` (will only act on `~/.ssh-menu/` directory) and run with `./ssh-menu`.
|
- install with `./install` (will only act on `~/.ssh-menu/` directory) and run with `./ssh-menu`.
|
||||||
|
|
||||||
Tips:
|
Tips:
|
||||||
|
|||||||
7
generate-hosts-sample
Executable file
7
generate-hosts-sample
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# Clean cache
|
||||||
|
echo -n > ~/.cache/rofi-2.sshcache
|
||||||
|
|
||||||
|
# Add only root@localhost
|
||||||
|
echo "1 root@localhost" >> ~/.cache/rofi-2.sshcache
|
||||||
12
install
12
install
@@ -8,15 +8,15 @@ fi
|
|||||||
mkdir -p ~/.ssh-menu
|
mkdir -p ~/.ssh-menu
|
||||||
|
|
||||||
# Install rofi-config-own or default rofi-config
|
# Install rofi-config-own or default rofi-config
|
||||||
if [ -e rofi-config-own ]; then
|
if [ -e rofi-config ]; then
|
||||||
cp rofi-config-own ~/.ssh-menu/rofi-config
|
cp rofi-config ~/.ssh-menu/rofi-config
|
||||||
else
|
else
|
||||||
cp rofi-config ~/.ssh-menu/rofi-config
|
cp rofi-config-sample ~/.ssh-menu/rofi-config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install rofi-forge-cache-own script or default rofi-forge-cache
|
# Install rofi-forge-cache-own script or default rofi-forge-cache
|
||||||
if [ -e rofi-forge-cache-own ]; then
|
if [ -e generate-hosts ]; then
|
||||||
cp rofi-forge-cache-own ~/.ssh-menu/rofi-forge-cache
|
cp generate-hosts ~/.ssh-menu/generate-hosts
|
||||||
else
|
else
|
||||||
cp rofi-forge-cache ~/.ssh-menu/rofi-forge-cache
|
cp generate-hosts-sample ~/.ssh-menu/generate-hosts
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#! /bin/bash
|
|
||||||
|
|
||||||
# Clean cache
|
|
||||||
echo -n > ~/.cache/rofi-2.sshcache
|
|
||||||
|
|
||||||
# Look for hostfiles named after target names in $INFRA/host/
|
|
||||||
ls ${INFRA}/host/ | sed "s/^/1 root@/" >> ~/.cache/rofi-2.sshcache
|
|
||||||
6
ssh-menu
6
ssh-menu
@@ -1,10 +1,10 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
# Generate ~/.cache/rofi-2.sshcache
|
# Generate ~/.cache/rofi-2.sshcache
|
||||||
if [ -x ~/.ssh-menu/rofi-forge-cache ]; then
|
if [ -x ~/.ssh-menu/generate-hosts ]; then
|
||||||
~/.ssh-menu/rofi-forge-cache
|
~/.ssh-menu/generate-hosts
|
||||||
else
|
else
|
||||||
echo "error: ~/.ssh-menu/rofi-forge-cache doesn't exist or can't be executed"
|
echo "error: ~/.ssh-menu/generate-hosts doesn't exist or can't be executed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user