PS1='\l:\H:\w # '
if [ -x /bin/hostname ] ; then
  PS1='\l:$(/bin/hostname 2>/dev/null):\w # '
fi

export LIBGL_ALWAYS_INDIRECT=1

alias ll="ls -l"
alias la="ls -la"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."

function dhcpcd {
  if [ -z "$1" ] ; then
    x=
    x=$( cd /sys/class/net ; for i in * ; do [ "$i" = lo ] || x="$x $i" ; done ; echo $x )
    echo "available interfaces: $x"
    return
  fi

  act=up

  if [ "$1" = "-k" ] ; then
    act=down
    shift
  fi

  iface=$1

  # match ethX to x-th ethernet interface
  if [ ! -d /sys/class/net/$iface ] ; then
    x=
    x=($( cd /sys/class/net ; for i in e* ; do [ -d "$i" ] && x="$x $i" ; done ; echo $x ))
    iface1=
    case $iface in eth*) iface1=${x[${iface/eth/}]} ;; esac
    if [ -n "$iface1" ] ; then
      echo "$iface = $iface1"
      iface=$iface1
    fi
  fi

  if [ "$act" = down ] ; then
    wicked ifdown $iface
    return
  fi

  c="/etc/sysconfig/network/ifcfg-$iface"
  [ ! -f "$c" ] && echo -e "BOOTPROTO='dhcp'\nSTARTMODE='auto'" >"$c"
  wicked ifup $iface
}
