2 questions,

1.how i become to be ask the Rootpassword ask like on the other draktools ?
2. and how can i at best check , if this run on terminal or on X,
because, i can let run  via xdialog also in
the X as wm-independed Configurationsdialog.
So, therewith able to use in the Draktools,
maybe not fully integrated, but WM independed..

so, this is so far an "beta", i develop it further
and check out what's all possible.. tomorrow..

by side, i develop  the script draknetcli further
and make it with hostnamectl.. but i be now very tired..

good night.

best regards
Blacky


Am 07.03.2015 um 23:45 schrieb Blackcrack:
editor it's the kwrite in console.. :\
but users choice, well idea !

Am 07.03.2015 um 23:33 schrieb Blackcrack:
oky :)

like i told, the version it's rolling on :)
with dialog :) if i become on :)

Am 07.03.2015 um 22:20 schrieb Tomasz Paweł Gajc:
Dnia środa, 4 marca 2015 22:45:38 Blackcrack pisze:
Hi,
an short solution for our command prompt geeks ;)
we can remove the old drakconnect and some
and have an solution for the prompt for have easy an
way to understand what's we can use and anybody
who works in the prompt it's this understandable if he
works with drakconf and draktools via drak[tab|tab]
(so the tabulator key's for see what's all possible..)
and draknetcli it's possible for configuring the network,
i hope you're have fun for configuring the network in
the cli / prompt / Command Line with this lil' tool :)

Hi Balcky,

thanks for this contribution, your script looks nice.

Please add two things in your script.
1. First use $EDITOR, if it is empty then give user choice to what editor use
(mcedit vi, etc..)
2. Use hostnamectl for setting up a host name.





_______________________________________________
OM-Cooker mailing list
[email protected]
http://ml.openmandriva.org/listinfo.cgi/om-cooker-openmandriva.org




_______________________________________________
OM-Cooker mailing list
[email protected]
http://ml.openmandriva.org/listinfo.cgi/om-cooker-openmandriva.org


#!/bin/sh
if [[ $EUID -ne 0 ]]; then
    echo "you must be root to use this script!"
exit 1
  else

#while true
#  do 

#while : 
#do

  

# utilitymenu.sh - A sample shell script to display menus on screen
# Store menu options selected by the user
INPUT=/tmp/menu.sh.$$
 
# Storage file for displaying cal and date command output
OUTPUT=/tmp/output.sh.$$
 
# get text editor or fall back to vi_editor
vi_editor=${EDITOR-vi}
 
# trap and delete temp files
trap "rm $OUTPUT; rm $INPUT; exit" SIGHUP SIGINT SIGTERM

hostnm=$(hostname)
hostaddr=$(hostname --ip-address)                                               
                #also ip6 (not used)
addrdev=$(ifconfig | grep flags | grep -v "lo"  | awk -F: '{$5="lo" ; print 
$1;}')               #grabing the active netdevice
addr=$(ip addr show $addrdev | awk '$1 == "inet" {gsub(/\/.*$/, "", $2); print 
$2}')        #ip4
addresse6=$(ip addr show $addrdev | awk '$1 == "inet6" {gsub(/\/.*$/, "", $2); 
print $2}')      #ip6
version=2.0.0.3
versdate=2015.03.08

  
netinformation(){
dialog --msgbox "\n
             Draknet Network Informations Board
\n       Draknet Version $version from $versdate \n\n
\n
\n
Hostname                                : $hostnm \n
\n
First Network Adapter                   : $addrdev \n
\n
Host ip4 Adress via ip  grep&awk        : $addr \n
\n
Host ip6 Adress via ip  grep&awk        : \n $addresse6 \n
\n
Host ip6 Adress via hostname --ip-adress: \n $hostaddr \n
\n



" 50 80     
                 }




hosts(){
dialog --clear --backtitle 'Draknet Center'  --title 'Drak NetworkManager'  
--menu  '      You can use the UP/DOWN arrow keys, the first \n     letter of 
the choice as a hot key, or the \n    number keys 1-9 to choose an option. 
Choose the TASK' 25 70 8 \
     mcedit   "  Edit hosts file with mcedit ?   "  \
     vi       "   Edit hosts file with vi ?       "  \
     i-vim      "   Edit hosts file with vim ?      "  \
     emacs    "   Edit hosts file with emacs ?    "  \
     pico     "   Edit hosts file with Pico ?     "  \
     joe      "   Edit hosts file with joe ?      "  \
     nano     "   Edit hosts file with nano ?     "  \
     headmenu  "         Go To Start               "  2>"${INPUT}"
 
 eded=$(<"${INPUT}")
    
        case $eded in
        mcedit)
          mcedit /etc/hosts && hosts
           ;;
        vi)
           vi /etc/hosts  && hosts
            ;;
        i-vim)
           vim /etc/hosts && hosts
            ;;
        emacs)
           emacs /etc/hosts  && hosts
              ;;
        pico)
             pico /etc/hosts  && hosts
              ;;
        joe)
             joe /etc/hosts && hosts
              ;; 
        nano)
             nano /etc/hosts  && hosts
             ;;
        headmenu)
             
             start  ;;
esac

}
#---------------------Setting u Hostname----------------------
setuphostname(){

    dialog --inputbox \
   "What is your Computername? \n     hostname.domain" 0 0 2> 
/tmp/inputbox.tmp.$$
       retval=$?
       input=`cat /tmp/inputbox.tmp.$$`
       rm -f /tmp/inputbox.tmp.$$
       case $retval in
       0)
        hostnamectl setuphostname $input && start ;;
       1)
       start 
        ;;
       esac
       }
#------------------------HeadProgramm-----------------------------
start(){

dialog --clear --backtitle 'Draknet Center'  --title 'Drak NetworkManager'  
--menu  '      You can use the UP/DOWN arrow keys, the first \n     letter of 
the choice as a hot key, or the \n    number keys 1-9 to choose an option. 
Choose the TASK' 25 70 7 \
      Information   "The full Information of the Network" \
      TerminaNetlUI "NetManager Terminal User Interface [nmtui]" \
      NetManUIEDIT  "NetManager Term UI Editor      [nmtui-edit]"  \
      NetHostName   "NetManager Term UI Hostname    [nmtui-hostname]"  \
      Connections   "NetManager Term UI Connections [nmtui-connection]"  \
      Hostnamectl   "Setting up your Hotname with hostnamectl "  \
      EditHosts     "Edit Hostsfile, know of the IP and Computernames" 
2>"${INPUT}"
 
 menuitem=$(<"${INPUT}")
 
     case $menuitem in
  Information)
  netinformation && start
   ;;
  TerminaNetlUI)
    mntui && start
    ;;
  NetManUIEDIT)
    mntui-edit && start
    ;;
  NetHostName)
   mntui-hostname && start
    ;;
  Connections)
   mntui-connection && start
    ;;
  Hostnamectl)
   setuphostname 
    ;;
   EditHosts)
     hosts
    ;; 
   Exit)
     echo "Bye"; break;;
    
  
  esac
}

start

#done

 
# if temp files found, delete em
[ -f $INPUT ] && rm $INPUT
[ -f $OUTPUT ] && rm $OUTPUT


fi
_______________________________________________
OM-Cooker mailing list
[email protected]
http://ml.openmandriva.org/listinfo.cgi/om-cooker-openmandriva.org

Reply via email to