Skip to content

Commit

Permalink
fix illegal option for TUI-based script; fake DHCP for jclone
Browse files Browse the repository at this point in the history
  • Loading branch information
olevole committed Mar 11, 2016
1 parent e0c0294 commit 0cbfad7
Show file tree
Hide file tree
Showing 35 changed files with 119 additions and 285 deletions.
10 changes: 10 additions & 0 deletions bsdconfig.subr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
#f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/mustberoot.subr
BSDCFG_LIBE="/usr/local/libexec/bsdconfig" APP_DIR="cbsd"

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

3 changes: 2 additions & 1 deletion jailctl/bcontrol-tui
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ set -e
set +e

. ${subr}
. ${dialog}
. ${strings}
. ${tools}

[ -z "${1}" ] && select_jail_by_list -s "List of local VMs:" -r 0 -e bls
init $*

. ${dialog}

dialog_menu_main()
{
repo=0 # flags for execution jsetup-tui from repo get image
Expand Down
5 changes: 3 additions & 2 deletions jailctl/border-tui
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ MYDESC="Ncurses based VM order editor"
EXTHELP="wf_jorder.html"

. ${subr}
. ${settingstui}
. ${tools}
. ${dialog}

init $*

. ${settingstui}
. ${dialog}

load_table()
{
local jnum=0
Expand Down
5 changes: 3 additions & 2 deletions jailctl/bsetup-tui
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ set -e
set +e

. ${subr}
. ${settingstui}
. ${dialog}
. ${strings}
. ${tools}

Expand All @@ -21,6 +19,9 @@ MYOPTARG="${JARG} outfile"

init $*

. ${settingstui}
. ${dialog}

commit()
{
local _oldjname _newjname
Expand Down
13 changes: 13 additions & 0 deletions jailctl/jclone
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ MYARG="old new host_hostname"
MYOPTARG="ip4_addr verbose"
MYDESC="Jail cloning"
CBSDMODULE="jail"
ADDHELP="ip4_addr - can be DHCP\n"

. ${subr}
. ${tools}
Expand All @@ -20,6 +21,18 @@ myjid=$( cbsdsql local SELECT jid FROM jails WHERE jname=\"${new}\" 2>/dev/null
[ -n "${myjid}" ] && err 1 "${MAGENTA}Jail already exist: ${GREEN}${new}${NORMAL}"

jname="${old}"

if [ "${ip4_addr}" = "DHCP" ]; then
dhcpip=$( dhcpd )
[ -z "${dhcpip}" ] && err 1 "${MAGENTA}Unable to dhcpd${NORMAL}"
ipwmask ${dhcpip}
[ -z "${IWM}" ] && err 1 "${MAGENTA}Unable IWM for dhcpd${NORMAL}"
iptype ${IWM}
[ $? -eq 0 ] && err 1 "${MAGENTA}Not ip from dhcpd?: ${dhcpip} / ${IWM}"
ip4_addr="${dhcpip}"
${ECHO} "${MAGENTA}Selected IP: ${GREEN}${ip4_addr}${NORMAL}"
fi

ip4_addr_new="${ip4_addr}"
host_hostname_new="${host_hostname}"

Expand Down
3 changes: 2 additions & 1 deletion jailctl/jcontrol-tui
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ set -e
set +e

. ${subr}
. ${dialog}
. ${strings}
. ${tools}

[ -z "${1}" ] && select_jail_by_list -s "List of local jails:" -r 0
init $*

. ${dialog}

dialog_menu_main()
{
repo=0 # flags for execution jsetup-tui from repo get image
Expand Down
6 changes: 4 additions & 2 deletions jailctl/jorder-tui
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ MYDESC="Ncurses based jail order editor"
EXTHELP="wf_jorder.html"

. ${subr}
. ${settingstui}
. ${tools}
. ${dialog}

init $*

. ${settingstui}
. ${dialog}


load_table()
{
local jnum=0
Expand Down
3 changes: 2 additions & 1 deletion jailctl/jrctl-tui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ MYOPTARG=""
MYDESC="Dialog based UI for RACCR/RCTL"

. ${subr}
. ${dialog}
. ${strings}
. ${tools}
. ${sharedir}/rctl.conf
Expand All @@ -15,6 +14,8 @@ MYDESC="Dialog based UI for RACCR/RCTL"
[ -z "${1}" ] && select_jail_by_list -s "List of local jails:" -r 0
init $*

. ${dialog}

. ${jrcconf}
[ $? -eq 1 ] && err 1 "${MAGENTA}No such jail: ${GREEN}${jname}${NORMAL}"

Expand Down
6 changes: 4 additions & 2 deletions jailctl/jsetup-tui
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/local/bin/cbsd
#v10.1.4
. ${subr}
. ${settingstui}
. ${dialog}
. ${strings}
. ${tools}

Expand All @@ -15,6 +13,10 @@ MYOPTARG="${JARG} outfile"

init $*

. ${settingstui}
. ${dialog}


commit()
{
local _oldjname _newjname
Expand Down
5 changes: 3 additions & 2 deletions modules/bsdconf.d/adduser-tui
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ MYDESC="Ncurses based dialog for jcreate"
CBSDMODULE="bsdconf"

. ${subr}
. ${settingstui}
. ${tools}
. ${dialog}
init $*

. ${settingstui}
. ${dialog}

f_include $BSDCFG_SHARE/strings.subr
f_include $BSDCFG_SHARE/usermgmt/group_input.subr
f_include $BSDCFG_SHARE/usermgmt/user_input.subr
Expand Down
19 changes: 5 additions & 14 deletions share/bsdconfig/cbsd/basecfg
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
#!/usr/local/bin/cbsd
############################################################ INCLUDES

BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/mustberoot.subr

BSDCFG_LIBE="/usr/local/libexec/bsdconfig" APP_DIR="cbsd"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

. ${subr}
. ${strings}
. ${tools}
Expand Down Expand Up @@ -96,6 +82,11 @@ dialog_menu_main()
############################################################ MAIN
export NOCOLOR=1

init $*
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
. ${workdir}/bsdconfig.subr


# Incorporate rc-file if it exists
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"

Expand Down
16 changes: 3 additions & 13 deletions share/bsdconfig/cbsd/bhyvecfg
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
#!/usr/local/bin/cbsd
############################################################ INCLUDES

BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/mustberoot.subr

BSDCFG_LIBE="/usr/local/libexec/bsdconfig" APP_DIR="cbsd"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

. ${subr}
. ${strings}
Expand Down Expand Up @@ -96,6 +83,9 @@ dialog_menu_main()
############################################################ MAIN
export NOCOLOR=1

. ${workdir}/bsdconfig.subr
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr

# Incorporate rc-file if it exists
[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"

Expand Down
19 changes: 3 additions & 16 deletions share/bsdconfig/cbsd/bhyvedsk
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
#!/usr/local/bin/cbsd
############################################################ INCLUDES

BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/mustberoot.subr

BSDCFG_LIBE="/usr/local/libexec/bsdconfig" APP_DIR="cbsd"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages-bhyvedsk.subr

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

############################################################ FUNCTIONS

# dialog_menu_main
#
# Display the dialog(1)-based application main menu.
Expand Down Expand Up @@ -126,6 +110,9 @@ set +e
. ${tools}
init $*

. ${workdir}/bsdconfig.subr
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages-bhyvedsk.subr

. ${jrcconf}
[ $? -eq 1 ] && err 1 "${MAGENTA}No such VM: ${GREEN}${jname}${NORMAL}"
[ "${emulator}" != "bhyve" ] && err 1 "${MAGENTA}Not in bhyve mode${NORMAL}"
Expand Down
16 changes: 3 additions & 13 deletions share/bsdconfig/cbsd/bhyvedsk-cfgdsk
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
#!/usr/local/bin/cbsd
############################################################ INCLUDES

BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/mustberoot.subr

BSDCFG_LIBE="/usr/local/libexec/bsdconfig" APP_DIR="cbsd"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages-bhyvedsk.subr

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

. ${subr}
. ${strings}
Expand Down Expand Up @@ -110,6 +97,9 @@ set +e
. ${tools}
init $*

. ${workdir}/bsdconfig.subr
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages-bhyvedsk.subr

. ${jrcconf}
[ $? -eq 1 ] && err 1 "${MAGENTA}No such VM: ${GREEN}${jname}${NORMAL}"
[ "${emulator}" != "bhyve" ] && err 1 "${MAGENTA}Not in bhyve mode${NORMAL}"
Expand Down
19 changes: 3 additions & 16 deletions share/bsdconfig/cbsd/bhyvedsk-newdsk
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
#!/usr/local/bin/cbsd
############################################################ INCLUDES

BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/mustberoot.subr

BSDCFG_LIBE="/usr/local/libexec/bsdconfig" APP_DIR="cbsd"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages-bhyvedsk.subr

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

. ${subr}
. ${strings}
. ${tools}

############################################################ FUNCTIONS

# dialog_menu_main
#
# Display the dialog(1)-based application main menu.
Expand Down Expand Up @@ -99,6 +83,9 @@ set +e
. ${tools}
init $*

. ${workdir}/bsdconfig.subr
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages-bhyvedsk.subr

. ${jrcconf}
[ $? -eq 1 ] && err 1 "${MAGENTA}No such VM: ${GREEN}${jname}${NORMAL}"
[ "${emulator}" != "bhyve" ] && err 1 "${MAGENTA}Not in bhyve mode${NORMAL}"
Expand Down
19 changes: 4 additions & 15 deletions share/bsdconfig/cbsd/bhyvenic
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
#!/usr/local/bin/cbsd
############################################################ INCLUDES

BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/mustberoot.subr

BSDCFG_LIBE="/usr/local/libexec/bsdconfig" APP_DIR="cbsd"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages-bhyvenic.subr

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

############################################################ FUNCTIONS

# dialog_menu_main
#
Expand Down Expand Up @@ -120,6 +105,10 @@ set +e
. ${vimageconf}
init $*

. ${workdir}/bsdconfig.subr
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages-bhyvenic.subr


. ${jrcconf}
[ $? -eq 1 ] && err 1 "${MAGENTA}No such VM: ${GREEN}${jname}${NORMAL}"
[ "${emulator}" != "bhyve" ] && err 1 "${MAGENTA}Not in bhyve mode${NORMAL}"
Expand Down
19 changes: 3 additions & 16 deletions share/bsdconfig/cbsd/bhyvenic-cfgnic
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
#!/usr/local/bin/cbsd
############################################################ INCLUDES

. ${subr}
. ${tools}
. ${dialog}
. ${strings}

BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
f_dprintf "%s: loading includes..." "$0"
f_include $BSDCFG_SHARE/dialog.subr
f_include $BSDCFG_SHARE/mustberoot.subr

BSDCFG_LIBE="/usr/local/libexec/bsdconfig" APP_DIR="cbsd"
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages-bhyvenic.subr

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

############################################################ FUNCTIONS

# dialog_menu_main
#
# Display the dialog(1)-based application main menu.
Expand Down Expand Up @@ -112,6 +96,9 @@ set +e
. ${vimageconf}
init $*

. ${workdir}/bsdconfig.subr
f_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages-bhyvenic.subr

. ${jrcconf}
[ $? -eq 1 ] && err 1 "${MAGENTA}No such VM: ${GREEN}${jname}${NORMAL}"
[ "${emulator}" != "bhyve" ] && err 1 "${MAGENTA}Not in bhyve mode${NORMAL}"
Expand Down

0 comments on commit 0cbfad7

Please sign in to comment.