one solved, any window have an $WINDOWID, this it is, what i let check, it is higher as " " use an other parameters and variables, if have an windowid, use it xdialog and so .. i hope it's works well.. i make i an fail ? how ever, in promt/cli should draknet work well.

the 2nd rootpasswort, something lik i has read, if the owner root,
ask for the rootpassword or something  in WM. i hope i be right :)

well, so have amanny fun with draknet 2.0.1.2 from today :)

best regards
Blacky

Am 08.03.2015 um 02:42 schrieb Blackcrack:
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




_______________________________________________
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

if [ -f /usr/bin/Xdialog ] ;then

#while true
#  do 

#while : 
#do


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.1.2
versdate=2015.03.08


if [ $WINDOWID ]; then 
 usdialog='Xdialog'
 winsize='0 0'
 break
 else
 usdialog='dialog'
 winsize='40 60'
 fi

removevariables(){
unset hostaddr
unset hostalias
unset hostnm
unset addr
unset addrdev
unset addresse6
unset address
unset versdate
unset version
unset xhostnameinfo
unset usdialog
unset winsize
}

netinformation(){
hostnm=$(hostname)
addr=$(ip addr show $addrdev | awk '$1 == "inet" {gsub(/\/.*$/, "", $2); print 
$2}')        #ip4

xhostnameinfo=$(hostnamectl status )
$usdialog --backtitle 'draknet Center' --title 'Draknet Network Informations 
Board' --msgbox "\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
$xhostnameinfo \n\n draknet Version $version from $versdate \n\n

" $winsize    
                 }




# 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; removevariables ; exit" SIGHUP SIGINT SIGTERM




hostsedit(){
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' $winsize 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 && hostsedit
           ;;
        vi)
           vi /etc/hosts  && hostsedit
            ;;
        i-vim)
           vim /etc/hosts && hostsedit
            ;;
        emacs)
           emacs /etc/hosts  && hostsedit
              ;;
        pico)
             pico /etc/hosts  && hostsedit
              ;;
        joe)
             joe /etc/hosts && hostsedit
              ;; 
        nano)
             nano /etc/hosts  && hostsedit
             ;;
        headmenu)
             
             draknetconf  ;;
esac

}
#---------------------Setting u Hostname----------------------

sethostname(){
    hostnm=$(hostname)
    addr=$(ip addr show $addrdev | awk '$1 == "inet" {gsub(/\/.*$/, "", $2); 
print $2}')        #ip4
    $usdialog --title "draknet Hostname" --backtitle "hostnamectl set-hostname 
<name>" --inputbox \
   "What is your Computername ? \n actual Name: $hostnm \n actual IP : $addr \n 
----------------------\n    hostname.domain" $winsize 2> /tmp/inputbox.tmp.$$
       retval=$?
       input=`cat /tmp/inputbox.tmp.$$`
       rm -f /tmp/inputbox.tmp.$$
       case $retval in
       0)
       hostnamectl set-hostname $input
       hostalias=$( echo $input | awk -F. '{print $1}' ) 
       printf "#generate by Draknet, please use draknet for configure you 
Network \n[localhost] \n127.0.0.1 localhost.localdomain localhost\n # The 
following lines are desirable for IPv6 capable hosts \n::1 ip6-localhost 
ip6-loopback \nfe00::0 ip6-localnet \nff00::0 ip6-mcastprefix \nff02::1 
ip6-allnodes \nff02::2 ip6-allrouters \nff02::3 ip6-allhosts\n[ip4adress] 
\n$addr $input $hostalias " > /etc/hosts
       echo "$hostalias"
       unset hostalias
       unset input
        ;;
       1)
       draknetconf #go back
        ;;
       esac
       draknetconf
       }
#------------------------HeadProgramm-----------------------------

draknetconf(){

ERGEBNIS=$( $usdialog --stdout --backtitle "Draknet" --menu "Draknet Netowrk 
Configurator" $winsize 10 \
                    0 "Network Informations" \
                    1 "Network Editor" \
                    2 "Setting up your Hostname" \
                    3 "Edit /etc/hosts" \
                    4 "Prompt Only : mntui-edit " \
                    5 "Prompt Only : mntui-connections" \
                    6 "Restart Network" )
            case $? in
                 0)
       case $ERGEBNIS in
     0)
       netinformation && draknetconf
        ;; 
     1)
       if [ $WINDOWID ]; then 
            nm-connection-editor && draknetconf
            break
         else
              nmtui && draknetconf
        fi
       ;;
    2)
     sethostname && draknetconf      
       ;;
     3)
        if [ $WINDOWID ]; then 
          editor /etc/hostsfile && draknetconf
          break
        else   
          hostsedit && draknetconf
        fi  
        ;;
    4)
     if [ $WINDOWID ]; then 
         $usdialog --msgbox "i told, Prompt Only !" 40 40 && draknetconf
            break
         else
              mntui-edit && draknetconf
        fi
       
      ;;
    5)
     if [ $WINDOWID ]; then 
         $usdialog --msgbox "i told, Prompt Only !" 40 40 && draknetconf
            break
         else
              mntui-connections && draknetconf
        fi
      ;; 
    6)
      $usdialog --infobox "Placeholder !" 15 35 && draknetconf
      ;; 
     esac
   #echo "esac-end ;)"
   ;;
 1)
  #echo "Es wurde abgebrochen"
  clear
  removevariables
  exit
 ;;
esac
    
   
 
 removevariables
  exit

  }

draknetconf

#done

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

else
urpmi --auto Xdialog

draknet

fi

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

Reply via email to