Appendix L. How to write a Linux System Administration Tool


Introducing LISA

A System Administration tool is a program, generally text-based capable to run the necessary tasks to configure the system. While RedHat and Mandrake adopt the linuxconf. Caldera based on LST continue to use LISA.

LISA stand for Linux Installation and System Administration and is the better effort made by Ralph Flaxa in its now moved distro: LST. SuSE also haves its SysAdm tool and is more complete but the Flaxa approach to write and develop its "lisa" is more easy and effective, and the Yast.

On a Caldera OpenLinux system (any from Caldera Network Desktop until actual version), simply run:

[root@world /root]# lisa
 




In true there are no binaries. Everything is made using Shell programming.

For example the first screen is the following:

box --help :MENU_MAIN_HELP: --default Menu_Config --title :MENU_MAIN_TITLE: --menu :MENU_MAIN_TEXT: Menu_Analyse :MENU_ANALYSE: Menu_Pkg :MENU_PKG: Menu_Config :MENU_CONFIG: hilfe :MENU_HELP:
 

Therefore there are nothing magic. However, is a simple intelligent use of the resources.

While "lisa" is a UNIX script, the "box" program, that is the program that create the layout and border effect is simple curses program.

[root@world /root]# file /bin/lisa /bin/box
/bin/lisa: Bourne shell script text
/bin/box:  ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked (uses shared libs), stripped
[root@world /root]#

Please note the libcurses dependencies:

[root@world /root]# strings /bin/box | grep curses
libncurses.so.4
[root@world /root]#

The Configuration file for LISA is: "lst.cnf", that we includes here to explain.

# /etc/lst.cnf  general setup for LISA and the distribution
#
# Copyright (C) 1993-1994 Ralf Flaxa, Linux Support Team, Erlangen, Germany
# Copyright (C) 1995-1997 Ralf Flaxa, LST Software GmbH, Erlangen, Germany
# Copyright (C) 1998-2000 Ralf Flaxa, Caldera (Deutschland) GmbH,
#                         Erlangen, Germany
#
# $Id: lst.cnf,v 3.37 2000/02/15 00:18:27 rf Exp $
#

# this should not be hardcoded but determined dynamically from the database
LST_SERVICES="MAIN TEXT X DEVEL XDEVEL NET SERV"
LST_SERIES="basis xbasis develop doku misc network tex text xappl xdevelo xemacs xview xextra"

CMD_BOX="box"
export PKG_NUM_DONE=0
export PKG_NUM_ALL=0
export PKG_KB_DONE=0
export PKG_KB_ALL=0
export PKG_SAVE=true
export PKG_REMOVE_INSTALLED=

export FUNC_NAME=
export DIR_BIN=
export DIR_DATA=
export DIR_PKGS=
export CND10_MODE=
export NEED_TO_REBOOT=
export LAST_USER=

#
# Environment sensitive variables
#
: DIR_ROOT=${DIR_ROOT="/"}
: DIR_SOURCE=${DIR_SOURCE="/mnt"}
: DIR_TARGET=${DIR_TARGET="/root"}
: DO_SIMULATE=${DO_SIMULATE=""}

#
# LST tmp area
#
DIR_LST_TMP=/tmp/LST
rm -fr $DIR_LST_TMP
mkdir -p $DIR_LST_TMP
FILE_TMP_DEBUG=/dev/tty8
FILE_TMP_ANSWER=$DIR_LST_TMP/answer
FILE_TMP_COMMAND=$DIR_LST_TMP/command
FILE_TMP_ERR=$DIR_LST_TMP/err
FILE_TMP_MSG=$DIR_LST_TMP/msg
FILE_TMP_VAL=$DIR_LST_TMP/val
FILE_TMP_LOG=$DIR_LST_TMP/log
export FILE_TMP_ANSWER
FILE_ROOT_SEL=$DIR_LST_TMP/root.sel
FILE_TARGETS_SEL=$DIR_LST_TMP/targets.sel
FILE_SWAP_SEL=$DIR_LST_TMP/swap.sel
FILE_PKGS_SEL=$DIR_LST_TMP/pkgs.sel
FILE_DISKS_SEL=$DIR_LST_TMP/disks.sel
FILE_SERIES_SEL=$DIR_LST_TMP/series.sel
FILE_META_SEL=$DIR_LST_TMP/meta.sel
FILE_SERVICES_SEL=$DIR_LST_TMP/services.sel
FILE_VALUES_SEL=$DIR_LST_TMP/values.sel
touch $FILE_VALUES_SEL

#
# pkgs area
#
DIR_LOG_PKGS=/install
DIR_LOG_INSTALLED=$DIR_LOG_PKGS/installed
DIR_LOG_CATALOG=$DIR_LOG_PKGS/catalog
DIR_LOG_CONTENTS=$DIR_LOG_PKGS/contents
DIR_LOG_CONFLICTS=$DIR_LOG_PKGS/conflicts
DIR_LOG_SCRIPTS=$DIR_LOG_PKGS/scripts
DIR_LOG_DISKS=$DIR_LOG_PKGS/disks
DIR_LOG_SAVED=$DIR_LOG_PKGS/saved
DIR_LOG_REPLACED=$DIR_LOG_PKGS/replaced
DIR_LOG_DELETED=$DIR_LOG_PKGS/deleted
DIR_LOG_ERRORS=$DIR_LOG_PKGS/errors
for logdir in $DIR_LOG_INSTALLED $DIR_LOG_SCRIPTS $DIR_LOG_DISKS $DIR_LOG_CATALOG $DIR_LOG_CONTENTS $DIR_LOG_CONFLICTS $DIR_LOG_SAVED $DIR_LOG_REPLACED $DIR_LOG_DELETED $DIR_LOG_ERRORS ; do
mkdir -p $logdir
done

#
# LST log area
#
DIR_LST_LOG=/var/adm/LST
DIR_LOG_ANALYSE=$DIR_LST_LOG/analyse
DIR_LOG_LOG=$DIR_LST_LOG/log
for logdir in $DIR_LOG_ANALYSE $DIR_LOG_LOG ; do
mkdir -p $logdir
done
FILE_LOG_HISTORY=$DIR_LOG_LOG/history
FILE_DEBUG_TRACE=$DIR_LOG_LOG/cmd.trace

#
# LST analyse area
#
FILE_BOOT_TIME=$DIR_LOG_ANALYSE/boot.time
FILE_BOOT_MSG=$DIR_LOG_ANALYSE/boot.msg
FILE_BOOT_PART=$DIR_LOG_ANALYSE/boot.part
FILE_BOOT_DIAG=$DIR_LOG_ANALYSE/boot.diag
FILE_BOOT_INFO=$DIR_LOG_ANALYSE/boot.info
FILE_BOOT_PARAMS=$DIR_LOG_ANALYSE/boot.params
FILE_BOOT_IMAGE=$DIR_LOG_ANALYSE/boot.img

#
# LST lib area
#
DIR_LST_LIB=/usr/lib/LST
mkdir -p $DIR_LST_LIB
FILE_META_DATA=$DIR_LST_LIB/meta.db
FILE_PKGS_DATA=$DIR_LST_LIB/pkgs.db
FILE_PKGS_INDEX=$DIR_LST_LIB/pkgs.idx
FILE_MODULES_DATA=$DIR_LST_LIB/modules.db
NUM_POS=8
NUM_PER_PARAM=4

#
# LST doc area
#
DIR_LST_DOC=/usr/doc/LST
mkdir -p $DIR_LST_DOC

#
# LST version
#
CONF_LST_VERSION="4.1.2"
CONF_LST_STATE="eCow"
CONF_LST_EDITION="LST"
CONF_COL_EDITION=""
CONF_LST_DATE="15.02.2000"
CONF_LST_KERNELVERSION="2.2.14"
CONF_LST_RELEASE="LST Version $CONF_LST_VERSION$CONF_LST_STATE $CONF_LST_EDITION Edition ($CONF_LST_DATE)"

#
# LST directory setup
#
DIR_LST=/lst
DIR_LST_DIST=$DIR_LST/$CONF_LST_VERSION/install
DIR_LST_IMAGES=$DIR_LST/$CONF_LST_VERSION/bootdisk/images
DIR_LST_BOOTDISK=$DIR_LST/bootdisk/current
DIR_LST_ROOTDISK=$DIR_LST/rootdisk/current
DIR_LST_SCRIPTS=$DIR_LST/scripts
DIR_LST_PKGS=$DIR_LST/pkgs

# The following configuration files are touched/changed
#
# General setup
#
FILE_SYSTEM_CONF=/etc/system.cnf
FILE_ETC_PASSWD=/etc/passwd
FILE_ETC_GROUP=/etc/group
FILE_ETC_SKEL=/etc/skel
FILE_ETC_FSTAB=/etc/fstab
#
# Init setup
#
DIR_INIT_CONF=/etc/rc.d
FILE_RC_LOCAL=$DIR_INIT_CONF/rc.local
DIR_INFO=/usr/info
CMD_INSTALL_INFO=/usr/bin/install-info
CMD_INETDCONF=/usr/lib/LST/inetdconf.pl
CMD_KDEAPPS=/usr/lib/LST/kdeapps
CMD_GROUP=/usr/lib/LST/group.pl
unset GZIP
#
# Mtools setup
#
FILE_MTOOLS=/etc/mtools
#
# LILO setup
#
FILE_LILO_CONF=/etc/lilo.conf
FILE_LILO_MESSAGE=/boot/message
#
# SILO setup
#
FILE_SILO_CONF=/etc/silo.conf
FILE_SILO_MESSAGE=/boot/message
#
# Dosemu setup
#
FILE_DOSEMU_CONF=/etc/dosemu.conf
#
# teTeX setup
#
DIR_TETEX_CONF=/usr/TeX
#
# apsfilter setup
#
DIR_APSFILTER_CONF=/usr/lib/apsfilter
FILE_APSFILTER_RC=/etc/apsfilterrc
#
# mgetty + sendfax setup
#
FILE_MGETTY_CONF=/etc/mgetty+sendfax/mgetty.config
FILE_SENDFAX_CONF=/etc/mgetty+sendfax/sendfax.config
#
# X11 setup
#
FILE_X11_CONF=/etc/XF86Config
#
# TCP/IP setup
#
FILE_ETC_HOSTS=/etc/hosts
FILE_ETC_RESOLV_CONF=/etc/resolv.conf
FILE_ETC_NETWORKS=/etc/networks
FILE_ETC_EXPORTS=/etc/exports
FILE_ETC_GATEWAYS=/etc/gateways
FILE_ETC_HOST_CONF=/etc/host.conf
FILE_ETC_INETD_CONF=/etc/inetd.conf
FILE_ETC_RC_INET1=$DIR_INIT_CONF/rc.inet1
FILE_ETC_RC_INET2=$DIR_INIT_CONF/rc.inet2
#
# Mail setup
#
DIR_SMAIL_CONF=/etc/smail
FILE_SMAIL_CONFIG=$DIR_SMAIL_CONF/config
FILE_SMAIL_ROUTERS=$DIR_SMAIL_CONF/routers
FILE_SMAIL_DIRECTORS=$DIR_SMAIL_CONF/directors
FILE_SMAIL_TRANSPORTS=$DIR_SMAIL_CONF/transports
#
# News setup
#
DIR_NEWS_CONF=/etc/news
FILE_NEWS_SYS=$DIR_NEWS_CONF/sys
FILE_NEWS_WHOAMI=$DIR_NEWS_CONF/whoami
FILE_NEWS_MAILNAME=$DIR_NEWS_CONF/mailname
FILE_NEWS_ORGANIZATION=$DIR_NEWS_CONF/organization
#
# NNTP setup
#
FILE_NNTP_SERVER=/etc/nntpserver
#
# Elm setup
#
FILE_ELM_RC=/var/lib/elm/elm.rc
#
# UUCP setup
#
DIR_UUCP_CONF=/etc/uucp
FILE_UUCP_CALL=$DIR_UUCP_CONF/call
FILE_UUCP_CONFIG=$DIR_UUCP_CONF/config
FILE_UUCP_DIAL=$DIR_UUCP_CONF/dial
FILE_UUCP_PORT=$DIR_UUCP_CONF/port
FILE_UUCP_SYS=$DIR_UUCP_CONF/sys
#
# NIS/YP setup
#
FILE_NIS_CONF=/etc/nis.conf
FILE_NIS_DEFAULTDOMAIN=/etc/defaultdomain

Therefore running the simple box program in combination with some PARAMETERS we get the magic. LISA uses also the system.cnf configuration file.

[root@world /root]# box -?

box version 4.1.2 - autosizing multilingual window user interface

Copyright (C) 1995-1997 Ralf Flaxa, LST Software GmbH <rf@lst.de>
Copyright (C) 1998-2000 Ralf Flaxa, Caldera (Deutschland) GmbH <rf@caldera.de>

Usage: box [FLAGS] [OPTIONS] [GENERAL_ARGS] [TYPE_ARGS]

FLAGS:                flags
  -?                  show this usage info
  -a                  alternative dictionary
  -r                  raw mode (no translation)
  -t                  translate only (pkgs.idx)
  -A                  alternative display mode
  -O                  output one of many only
  -P                  percent value of meter (0 <= val <= 100)
  -T                  translate only (libLSTtext)

OPTIONS:              options
  --nobutton          do not display buttons
  --auto              simulate keypress if default value available
  --expert            allow some specials for experts

GENERAL_ARGS:         general arguments for all box types
  --dictionary <file> use alternative dictionary <file> for translation
  --default <val/txt> default value or text
  --height <cols>     fixed height in columns (**)
  --width <rows>      fixed width in rows (**)
  --title <txt>       label in title bar (*)
  --text <txt>        text in main window (*)(***)
  --help <txt>        helptext when <F1> is pressed (*)
  --menutitle <txt>   label on top of a browse/menu/list subbox

TYPE_ARGS:            box type specific arguments
  --info <txt>        display message <txt> and continue (*)
  --msg <txt>         display message <txt> and wait for keypress (*)
  --browse <filename> display contents of file <filename> (***)
  --bool <txt>        ask for a bool value (*)
  --string <txt>      ask for a string value (*)
  --menu <txt>        choose one of many (menu style) (*)
  --one <txt>         select one of many (select style) (*)
  --multi <txt>       select many of many (select style) (*)
  --sumlist <txt>     select many of many (select style) and sumarize (*)
  --showlist <txt>    show list of items (*)

 (*):<txt> will be translated with dictionary (if -r not set)
 (**):not necessary (autosizing feature)
 (***):use --text to display texts above browse subbox

[root@world /root]#

LISA supports in a text-based mode the most important changes for a system administration tool. It covers Networking, Users Installation, Printers, System Analysis, Package Installation.


Is clear that this tool is better than the RedHat setup:

The RedHat Setup launchs different programs:

  1. authconfig - for authorization schema
  2. lokkit - FireWall configuration
  3. kdbconfig - For keyboard mapping
  4. mouseconfig - for the mouse
  5. netconfig - for the network cacrd
  6. printconf-tui - to setup the printer services
  7. ntsysv - to setup the init services
  8. sndconfig - to setup the sound card services
  9. timeconfig - To configure the date and time
  10. Xconfigurator - To configure X Window Cards
Is very important to note that while RedHat offers different programs (ten different programs to run different system administration taks), LISA uses a single program!

Note for example the lisa entry to setup the Init Services.
 




LISA also support package installation while RedHat does not support in text-mode.
 

[root@world /etc]# lizard
lizard_isp       lizard_modem     lizard_network   lizard_timezone  lizard_wrapper   lizard_xserver   lizardx
 

Generally this programs are copyright (LISA is copyright by Caldera and Yast is copyright by SuSE); however is very easy to write these tools and also offering a more complete approach.
 

The better mode to write a SysAdm tool.

As we see Caldera uses two different systems modes: libncurses for LISA and Qt for LIZARD. SuSE apply a similar approach for Yast and Yast2. And therefore this is not a good use.

The better mode is to use a unique programming language. Python offers and solves this. For example anaconda supports both: Text-based using courses and Graphical using tkinter. However, RedHat uses anaconda only for the installation phase and not for the setup. They uses "linuxconf" that is a non-RedHat program. Again, this is not a good solution. Nothing about package installation or Package Update. Mandrake instead also using linuxconf includes a program for package update.

Therefore there are no one of these that uses a unique programming language to solve the same system configuration problems.

The best mode is to use the same language and for both: Setup or Installation phase and Post-Installation, like daily configurations, for both text and graphical uses. Python is the better language to solve these tasks.

Of course, is also possible to use Python to write a program like LISA in Python that uses Wizard programs to repeat the configuration in both text-based and graphical modes. At the same time is possible to includes another program, similar to "Control Panel" that launch or configure in another mode the same sysadm tasks, like a tunning without to use wizard tools.

Of course, a high number of hardware type must be supported. For example, LISA does not support ISDN card configuration or sound card support.

SCO Unix for example, offers the same programs to administrate the system in both: Textual and Graphical. They uses Visual-Tcl a "different" program to solve these tasks. The solution is quite simple, because also the source is the same, but this possibility forces other changes on SCO Unix, that does not allow a standardization.
 

Internet Resources for this Appendix.