aboutsummaryrefslogtreecommitdiff
path: root/openbsd_net.sh
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2019-10-15 20:56:41 -0400
committerMitch Riedstra <mitch@riedstra.us>2019-10-15 20:56:41 -0400
commiteefbd029b55b2782b0d7b11b4989ce0ca9b256cd (patch)
tree535511fd3154342117d67171e28a312bd30c7f87 /openbsd_net.sh
parent5840f413825e053b645a338d71c1916a06094335 (diff)
downloaddotfiles-eefbd029b55b2782b0d7b11b4989ce0ca9b256cd.tar.gz
dotfiles-eefbd029b55b2782b0d7b11b4989ce0ca9b256cd.tar.xz
Massive organization of my dotfiles
Diffstat (limited to 'openbsd_net.sh')
-rwxr-xr-xopenbsd_net.sh83
1 files changed, 0 insertions, 83 deletions
diff --git a/openbsd_net.sh b/openbsd_net.sh
deleted file mode 100755
index ad8993d..0000000
--- a/openbsd_net.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/sh
-set -e
-
-# No trailing slash
-conf_dir="/etc/net"
-interface="iwn0"
-
-help(){
-cat <<EOF
-Usage: $0 [option]
-
-$0 Allows you to set, edit, or display saved interface configurations placed
-in "$conf_dir".
-
-Configurations are in the standard hostname.if(5) format.
-
-Where option is:
- -l List all of the available network names.
- -s "\$name" Sets the network name
- -e "\$name" Edit the configuration file of "\$name"
- -d "\$name" Display the configuration file of "\$name"
- -i "\$interface" Override the interface ($interface) set in the script.
- -D Set the interface down and remove all IP addresses
-EOF
-if ! [ -z "$1" ] ; then
- exit "$1"
-else
- exit 0
-fi
-}
-
-list() {
- find "$conf_dir" -type f | sed -e"s@$conf_dir/@@g"
-}
-
-edit_net() {
- if [ -z "$1" ] ; then
- echo "Please pass in a file name!"
- exit 1
- fi
- _f="$1"; shift
- "$EDITOR" "${conf_dir}/$_f"
-}
-
-display_net() {
- if [ -z "$1" ] ; then
- echo "Please pass in a file name!"
- exit 1
- fi
- _f="$1"; shift
- cat "${conf_dir}/$_f"
-}
-
-set_net() {
- if [ -z "$1" ] ; then
- echo "Please pass in a file name!"
- exit 1
- fi
- _f="$1"; shift
-
- if [ -L "/etc/hostname.${interface}" ] ; then
- rm "/etc/hostname.${interface}"
- fi
- ln -s "${conf_dir}/$_f" "/etc/hostname.${interface}"
- sh /etc/netstart
-}
-
-down_net() {
- ifconfig "$interface" down -inet -inet6
-}
-
-if [ -z "$1" ] ; then
- help
-fi
-while [ $# -gt 0 ] ; do case $1 in
- -i) interface="$2"; shift; shift ;;
- -l) shift; list ; break ;;
- -s) shift; set_net "$@" ; break ;;
- -d) shift; display_net "$@" ; break ;;
- -e) shift; edit_net "$@" ; break ;;
- -D) shift; down_net "$@" ; break ;;
- *) help 1;;
-esac ; done