no longer embed BashStyle-NG into system bashrc for start up.

instead present the user a popup window that allows to add an entry for BashStyle-NG to user bashrc (or tell user how to manually do it).
parent c3cfb76b
......@@ -2,19 +2,38 @@ Overview of changes in v9.2 "Galvanize"
=== General ===
* StartUp mechanism changes:
++ before BashStyle-NG embedded into /etc/bash.bashrc or /etc/bashrc to add
a startup entry to ${HOME}/.bashrc
++ now if ${HOME}/.bashrc does not contain a startup entry for BashStyle-NG
the user is presented a popup window upon UI start asking whether to add
the entry or telling the user how to do it manually.
* PS2 / PS3 / PS4 changes:
++ before there's been an option for PS234. Setting this to ">" would result in:
+++ PS2=">" / PS3=">>" / PS4=">>>"
++ now there's an option for each (including a color option each)
++ before there's been an option for PS234. Setting this to ">" resulted in:
PS2=">"
PS3=">>"
PS4=">>>"
++ now there's an separate option for each (including a color option each)
++ furthermore PS2 / PS3 / PS4 export does now honor enable_colors setting
=== Configure 4.3.4 ===
4.3.5:
- remove system bashrc detection
- remove --profieldir switch
4.3.4:
- remove --quiet switch
- globally define PYMAXVER and PYMINVER (python minimum and maximum versions)
- globally define PYAMXVER_P and PYMINVER_P (printable python minimum and
maximum python versions for configure messages)
- remove unused variable
=== Make 1.0.5 ===
- update for no longer installed profiledir and profile script
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Overview of changes in v9.1 "Dial T for TNT"
......
#!/bin/sh
set -e
if [ ! $(grep "bashstyle.sh" /etc/bash.bashrc) >/dev/null 2>&1 ]; then
echo "
source /etc/bashstyle.sh" >> /etc/bash.bashrc
fi
#DEBHELPER#
exit 0
#!/bin/sh
set -e
if [ $(grep "bashstyle.sh" /etc/bash.bashrc) >/dev/null 2>&1 ]; then
sed -e '/bashstyle.sh/d' -i /etc/bash.bashrc
fi
#DEBHELPER#
exit 0
......@@ -255,6 +255,84 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkDialog" id="popup">
<property name="can_focus">False</property>
<property name="title" translatable="yes">BashStyle-NG</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="icon_name">bs-ng</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="popup.enable">
<property name="label" translatable="yes">Enable</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="popup.cancel">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="popup.label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">BashStyle-NG is not loaded upon Shell start.
Click [Enable] to let the application add a startup
entry for itself into your ${HOME}/.bashrc
If you click [Cancel] changes done here won't take
effect. This popup will re-appear every time you
start the application and when there's no entry in
your ${HOME}/.bashrc
You can add the entry manually like:
source /usr/share/bashstyle-ng/rc/nx-rc
assuming /usr was the choosen install prefix. </property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkAdjustment" id="readline.adjustment.query_items">
<property name="upper">10000</property>
<property name="step_increment">1</property>
......
......@@ -57,6 +57,41 @@ class BashStyleNG(object):
gtkbuilder = widgethandler.gtkbuilder
WidgetHandler = widgethandler.WidgetHandler(config.cfo, config.udc, config.fdc)
######################## BashStyle-NG autostart stuff ##############################
def check_bashstyle():
rc = open(os.path.expanduser("~/.bashrc"), "r")
content = rc.readlines()
found = False
for line in content:
if line.find("bashstyle-ng/rc/nx-rc") != -1:
found = True
rc.close
return found
def set_bashstyle(widget, OnOff):
rc = open(os.path.expanduser("~/.bashrc"), "r")
rc_new = open(os.path.expanduser("~/.bashrc.new"), "w")
content = rc.readlines()
for line in content:
if line.find("bashstyle-ng/rc/nx-rc") == -1:
rc_new.write(line)
rc.close
if OnOff == True:
rc_new.write("source " + os.getenv('BSNG_DATADIR') + "bashstyle-ng/rc/nx-rc")
rc_new.close
shutil.move(os.path.expanduser("~/.bashrc.new"), os.path.expanduser("~/.bashrc"))
popup.hide()
if check_bashstyle() == False:
popup = gtkbuilder.get_object("popup")
popup_enable = gtkbuilder.get_object("popup.enable")
popup_cancel = gtkbuilder.get_object("popup.cancel")
popup_enable.connect("clicked", set_bashstyle, True)
popup_cancel.connect("clicked", lambda w: popup.hide() or True)
popup.connect("delete-event", lambda w: w.hide() or True)
popup.show_all()
####################### Style Options ##############################################
WidgetHandler.InitWidget("use_bashstyle", "Style", "use_bashstyle", "bool", None)
WidgetHandler.InitWidget("colored_prompts", "Style", "enable_colors", "bool", None)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment