Removed old script folder.
This commit is contained in:
parent
ef9eda1621
commit
3ac7f80213
4 changed files with 0 additions and 78 deletions
|
@ -1,22 +0,0 @@
|
||||||
#/usr/bin/env bash
|
|
||||||
|
|
||||||
_hopon_completions () {
|
|
||||||
# Check to see if a container/VM manager is installed.
|
|
||||||
local vm_manager=""
|
|
||||||
if [ -x "$(command -v incus)" ]; then
|
|
||||||
vm_manager="incus"
|
|
||||||
elif [ -x "$(command -v lxc)" ]; then
|
|
||||||
vm_manager="lxc"
|
|
||||||
else
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# We only want one copy of the found parameter.
|
|
||||||
if [ "${#COMP_WORDS[@]}" != "2" ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
COMPREPLY=($(compgen -W "$($vm_manager list -c n -f csv)" -- "${COMP_WORDS[1]}"))
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -F _hopon_completions hopon
|
|
|
@ -1,18 +0,0 @@
|
||||||
# hopon
|
|
||||||
|
|
||||||
A simple bash script for quickly accessing a linux container/VM. Has tab-completion enabled for Bash shells and can detect different container/VM managers.
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
* Bash
|
|
||||||
* LXD/LXC or Incus
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```
|
|
||||||
# hopon <container_or_vm_name>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
Run `sudo ./install.sh`
|
|
34
hopon/hopon
34
hopon/hopon
|
@ -1,34 +0,0 @@
|
||||||
#/usr/bin/env bash
|
|
||||||
|
|
||||||
# Check for the first parameter.
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "No container/VM name specified."
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check to see if a container/VM manager is installed.
|
|
||||||
if [ -x "$(command -v incus)" ]; then
|
|
||||||
vm_manager="incus"
|
|
||||||
elif [ -x "$(command -v lxc)" ]; then
|
|
||||||
vm_manager="lxc"
|
|
||||||
else
|
|
||||||
echo "No suitable container/VM manager detected."
|
|
||||||
echo "Make sure you have \"lxc\" or \"incus\" installed."
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Look for the specified container/VM.
|
|
||||||
exists=$("$vm_manager" list -c n -f csv | grep ^$1 -- 2>/dev/null)
|
|
||||||
|
|
||||||
if [ -n "$exists" ]; then
|
|
||||||
# The shell will be different depending on the Linux distro used.
|
|
||||||
IMAGEOS=$("$vm_manager" config get "$1" image.os)
|
|
||||||
if [ $IMAGEOS = "Alpine" ]; then
|
|
||||||
"$vm_manager" exec "$1" -- /bin/ash
|
|
||||||
else
|
|
||||||
"$vm_manager" exec "$1" -- /bin/bash
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Container/VM with name \"$1\" does not exist."
|
|
||||||
exit 2
|
|
||||||
fi
|
|
|
@ -1,4 +0,0 @@
|
||||||
#/bin/sh
|
|
||||||
|
|
||||||
install -m 755 hopon /usr/bin
|
|
||||||
install -m 755 010_hopon_completion.bash /etc/bash_completion.d
|
|
Loading…
Reference in a new issue