1. Moises Henriquez
  2. vasm

Commits

Moises Henriquez  committed bda6a9c

Revisions to setup.py, fixed references for correct dir structure

  • Participants
  • Parent commits 65b5516
  • Branches default

Comments (0)

Files changed (116)

File _build/PKGBUILD

View file
+# Contributor: pierce.jason [VL7]
+
+pkgname=vasm
+pkgver=3.0.98.0
+#pkgver=3.0.99.9
+pkgrel=1
+pkgdesc="Vectorlinux's Administration & System Menu (Alpha release). 
+System configuration tool for both TUI and GUI. Complete rewrite of 
+vasm with goals such as to provide greater modularity for 
+maintainability, better support for localization and 
+internationalization, and tighter integration with the distro 
+installer and with the system its self. The prior vasm has been 
+renamed and moved to vasm-legacy and will remain installed on the 
+system for your convenience."
+arch=('any')
+url="https://bitbucket.org/m0e_lnx/vasm/wiki"
+license=('GPL')
+depends=( 'python' 'urwid' 'pyparted' 'python-pexpect' 'psutil' 'vasm-legacy' )
+#ADDRB="urwid, pyparted, python-pexpect, psutil, vasm-legacy"
+ADDRB="urwid, pyparted, python-pexpect, psutil"
+optdepends=(	"gparted: Not yet in 64bit repo"
+		"vasm-legacy: The tried and true bash vasm") # Manually mirror to slack-suggests
+backup=("etc/sudoers.d/vasm")
+changelog="slack-changes"
+_hgrepo="pierce_jason"
+#_hgrepo="m0e_lnx"
+source=("https://bitbucket.org/$_hgrepo/vasm/get/$pkgver.tar.bz2"
+	"sudoers.d-vasm"
+	"vasm.desktop"
+	"vasm-tui.desktop")
+sha256sums=('ed8f036dadec3d9b1d2d1e58b316c05dd46e3b410817b449bccc1556b25fb9de'
+            'f3cf56b9a9e8578176ca64d5c69e2d8ddec4aa24a9278167a85d9bf915f21bab'
+            'cd5f2fd8ea9f73680683bdb1cae9857a2c02697efcdb54be8848a53d01ac94c1'
+            '5615e41705b84bf180ed95d6308db8b7a818ea153302bbcf3be12839b698e11a')
+build() {
+	python -m compileall .; # Pre-generate .pyc files.
+}
+package() {
+	cd $srcdir/$_hgrepo-$pkgname-$pkgver;
+	
+	mkdir -p $pkgdir/usr/share/$pkgname-$pkgver;	
+	cp *.{py,pyc} $pkgdir/usr/share/$pkgname-$pkgver/;
+	cp -a modules $pkgdir/usr/share/$pkgname-$pkgver/
+	
+	mkdir -p $pkgdir/usr/bin;
+	install -m755 vasm $pkgdir/usr/bin/;
+	
+	mkdir -p $pkgdir/usr/doc/$pkgname-$pkgver;
+	cp *.txt $pkgdir/usr/doc/$pkgname-$pkgver;
+	cp -a AUTHORS COPYING ChangeLog Credits MANIFEST README TODO \
+		$pkgdir/usr/doc/$pkgname-$pkgver/ 2>/dev/null || true;
+
+
+	cd $srcdir;
+	install -d -m700 $pkgdir/etc/sudoers.d
+	install -m400 sudoers.d-vasm $pkgdir/etc/sudoers.d/
+	
+	mkdir -p $pkgdir/usr/share/applications;
+	cp *.desktop $pkgdir/usr/share/applications/;
+}
+
+cat > /dev/null << 'EndofComment' 
+package() {
+	cd "$srcdir/$pkgname-$pkgver"
+	python setup.py install --root="$pkgdir/" --optimize=1;
+}
+EndofComment

File _build/PKGBUILD.devel

View file
+# Contributor: pierce.jason [VL7]
+
+pkgname=pyVasm-devel
+pkgver=0.0.99
+pkgrel=1
+pkgdesc="Update helper for pyVasm development tree."
+arch=('any')
+url="https://bitbucket.org/m0e_lnx/vasm/"
+license=('GPL')
+depends=('mercurial' 'urwid' 'pyparted' 'python-pexpect' 'psutil' 'sh' )
+ADDRB='mercurial, urwid, pyparted, python-pexpect, psutil, sh'
+install=
+options=(emptydirs)
+source=("pyVasm-helper.sh")
+sha256sums=('64fbf66e34676a8a4365b48555a9b5773fad2b9f992ec30a2e3613e5b2b075d6')
+
+package() {
+	cd $srcdir
+	mkdir -p $pkgdir/opt/$pkgname;
+	mkdir -p $pkgdir/usr/bin
+	
+	chmod 755 pyVasm-helper.sh;
+	cp pyVasm-helper.sh $pkgdir/usr/bin/;
+	ln -s /usr/bin/pyVasm-helper.sh $pkgdir/usr/bin/pyVasm
+}

File _build/slack-changes

View file
+* 7.0-noarch-3vl70
+	- Remove etc/sudoers for real this time. Forgot to do the rm on 2vl70.
+	- (* Note prior changes *)
+* 7.0-noarch-2vl70
+	- Fix sudo misconfiguration leading to local privilege escalation. Sudo access to vasm changed from group "users" to group "sys".
+	- Removed etc/sudoers file from package.
+	- Moved sudo configs related to this package into etc/sudoers.d/vasm
+	- (* Security fix *)
+	- pkg://vlconfig2
+	- http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-FAKECVE
+	- http://helic.wholebean.info/~pierce.jason/sudoers-vuln.txt

File _build/slack-suggests

View file
+gparted
+vasm-legacy

File _build/sudoers.d-vasm

View file
+# sudoers.d-vasm-0.2
+Cmnd_Alias VASM-LEGACY=/bin/vasm-legacy,/sbin/vasm-legacy,/sbin/vlapt
+Cmnd_Alias VASM=/usr/bin/vasm
+
+# Anyone in the group 'adm'(administrative special privs) can run some programs with a password.
+%adm ALL=VASM,VASM-LEGACY,HW2

File _build/vasm-devel.sh

View file
+#!/bin/sh
+SELF=$(basename $0 | cut -d. -f1)
+helper_ver="0.1"
+
+usage() {
+cat <<HELP
+$SELF - Update helper for ${pkgname%-devel} development tree.
+Handles update checking and launches ${pkgname%-devel}. Any options after a double
+dash -- are passed unmodified to the ${pkgname%-devel} subprocess.
+ver. $helper_ver
+
+Usage: $SELF [-u] [-h]
+Usage: $SELF [-a] [-l] [VASM UI] -- [VASM OPTS]
+
+Options:
+	-a, --alternate_source <mercurial repo>
+		Use alternate source repo for updates.
+		Default: $hg_url
+		NOTE: Option not current implemented.
+	-h,  --help
+		Output this help message.
+	-l, --library
+		Start helper in shell library mode. Do not run any functions.
+		Allow functions and variables to be sourced into an
+		interactive POSIX environment.
+	-u, --update
+		Run update checks then exit.	
+		
+VASM UI selects the user interface. If not specified, auto-selection is
+based on presence of running Xorg(env DISPLAY). Usually resulting in GUI.
+
+Valid VASM UI choices:
+	tui
+		Text user interface, utilizing urwid display toolkit.
+	gui
+		Graphical user interface, utilizing gtk display toolkit.
+HELP
+}
+
+
+#####################  Configuration  #####################
+
+pkgname="vasm-devel"
+pkgdir="/opt/$pkgname" # Location of files on disk
+hg_url="https://bitbucket.org/m0e_lnx/vasm" # Where to clone/pullfrom
+change_file=".hg/last_pull" # File for checking last pull
+update_timeframe="4"; # 4 days between update checks
+	
+#####################  Functions  #####################
+
+# Ensures directory exists and repo has been cloned.
+startup_verification() {
+	if [ ! -d "$pkgdir" ]; then
+		echo "Directory $pkgdir does not exist.";
+		echo -e "This should have been created by package install.\nExiting.";	
+		exit;
+	fi;
+	
+	cd $pkgdir;
+	
+	if [ ! -d "$pkgdir/.hg" ]; then
+		echo "Directory $pkgdir/.hg does not exist.";
+		echo "Devel repo not initialized. Cloning now.";
+		
+		hg clone $hg_url $pkgdir/; local hg_ret=$?;
+		touch_change_file $hg_ret;
+	fi;
+}
+
+# List files changed since last update.
+# Run between pull and update commands.
+show_changed() {
+	hg status --rev . --rev tip;
+}
+
+# Update the timestamp on our change_file.
+# First check if any problems pulling (hg_ret).
+touch_change_file() {
+	local hg_ret=$1;
+
+	if [ "$hg_ret" -gt "0" ]; then
+		echo "Problem pulling updates. hg returned status $hg_ret";
+		exit 1;
+	else
+		# 'Touch' the change_file.
+		echo "Do not remove." > $pkgdir/$change_file; 
+	fi;
+}
+
+# See if our check_file dates indicate a need to update.
+# Turn dates 2011-10-18* into 20111018 for doing math.
+# Prompt before checking for updates.
+need_updates() {
+	local last_pull;
+	local today;
+	local difference;
+	
+	if [ -f $pkgdir/$change_file ]; then
+		last_pull=$( stat -c%y $pkgdir/$change_file | cut -d " " -f1 | sed "s/-//g" );
+	else
+		get_updates;
+		return;
+	fi;
+	
+	today=$( date +%F | sed "s/-//g" );
+	difference=$(( $today - $last_pull ));
+	if [ "$difference" -gt "$update_timeframe" ]; then
+		echo "Time to check for updates. Run \`hg pull\` now? [Y/n]";
+		read confirm;
+		if [ "$confirm" != "n" ]; then
+			get_updates;
+			return;
+		else
+			echo "Update check aborted. You can do this at any time by running \`hg pull && hg update\`.";
+			return;
+		fi;
+	else
+		echo "Less than $update_timeframe days since last check. Not doing automatic update.";
+		echo "You can force update at any time by running \`$SELF -u\`.";
+	fi;
+}
+
+# Pull and display updates. Update change_file timestamp.
+# Prompt before merging updates into filesystem.
+get_updates() {
+	hg pull; local hg_ret=$?;
+	touch_change_file $hg_ret;
+	show_changed;
+	echo "Merge these changes? [Y/n]";
+	read confirm;
+	if [ "$confirm" != "n" ]; then
+		hg update;
+	else
+		echo "Merge aborted. You can do this at any time by running \`hg update\`.";
+	fi;
+}
+
+choose_ui() {
+	local ui_choice;
+	local ui_command;
+	
+	if [ -z "$1" ]; then
+		if [ -z "$DISPLAY" ]; then
+			ui_choice="tui";
+		else
+			ui_choice="gui";
+		fi;
+	else
+		ui_choice="$1";
+	fi;
+	
+	case "$1" in
+		tui	) ;;
+		gui	) ;;
+		*	) echo "Unknown ui selected: $ui_choice. If this is really what you want, try passing it directly to ${pkgname%-devel}."
+	esac;
+	
+	echo "Running ${pkgname%-devel} with selected UI: $ui_choice." > /dev/stderr;
+	echo $ui_command;
+}
+
+main() {
+	local ui_cmd;
+	
+	# Make sure we have a directory and a repo in place.
+	startup_verification;
+	
+	# Check timestamps to see if we need to try to update.
+	need_updates;	
+	
+	ui_cmd=$( choose_ui $1 );
+	
+	echo "python2 $ui_cmd";
+	python2 $ui_cmd;
+	exit 0;
+}
+
+#####################  Dispatcher code	#####################
+
+if [ -z "$1" ]; then
+	main;
+fi;
+
+until [ -z "$1" ]; do
+	case "$1" in
+		-a | --alternate_source ) hg_url="$2"; shift;;
+		-l | --library ) DO='';;
+		-u | --update ) startup_verification; DO="get_updates";;
+		-h | --help | -* ) usage; exit;;
+		* ) DO="main $1";;
+	esac;
+	shift;
+done;
+
+eval "$DO";

File _build/vasm-tui.desktop

View file
+[Desktop Entry]
+Comment[en_US]=VASM Text User Interface
+Comment=VASM Text User Interface
+Exec=/usr/bin/vasm -i tui
+GenericName[en_US]=VL Administration & System Menu
+GenericName=VL Administration & System Menu
+Icon=package-utilities
+MimeType=
+Name[en_US]=VASM (TUI)
+Name=VASM (TUI)
+Path=
+StartupNotify=true
+Terminal=true
+TerminalOptions=
+Type=Application
+Categories=Application;System;Utilities
+X-DBUS-ServiceName=
+X-DBUS-StartupType=
+X-KDE-SubstituteUID=false
+X-KDE-Username=

File _build/vasm.desktop

View file
+[Desktop Entry]
+Comment[en_US]=VASM Graphical User Interface
+Comment=VASM Graphical User Interface
+Exec=/usr/bin/vasm
+GenericName[en_US]=VL Administration & System Menu
+GenericName=VL Administration & System Menu
+Icon=package-utilities
+MimeType=
+Name[en_US]=VASM (GUI)
+Name=VASM (GUI)
+Path=
+StartupNotify=true
+Terminal=false
+TerminalOptions=
+Type=Application
+Categories=Application;System;Utilities
+X-DBUS-ServiceName=
+X-DBUS-StartupType=
+X-KDE-SubstituteUID=false
+X-KDE-Username=

File build/PKGBUILD

-# Contributor: pierce.jason [VL7]
-
-pkgname=vasm
-pkgver=3.0.98.0
-#pkgver=3.0.99.9
-pkgrel=1
-pkgdesc="Vectorlinux's Administration & System Menu (Alpha release). 
-System configuration tool for both TUI and GUI. Complete rewrite of 
-vasm with goals such as to provide greater modularity for 
-maintainability, better support for localization and 
-internationalization, and tighter integration with the distro 
-installer and with the system its self. The prior vasm has been 
-renamed and moved to vasm-legacy and will remain installed on the 
-system for your convenience."
-arch=('any')
-url="https://bitbucket.org/m0e_lnx/vasm/wiki"
-license=('GPL')
-depends=( 'python' 'urwid' 'pyparted' 'python-pexpect' 'psutil' 'vasm-legacy' )
-#ADDRB="urwid, pyparted, python-pexpect, psutil, vasm-legacy"
-ADDRB="urwid, pyparted, python-pexpect, psutil"
-optdepends=(	"gparted: Not yet in 64bit repo"
-		"vasm-legacy: The tried and true bash vasm") # Manually mirror to slack-suggests
-backup=("etc/sudoers.d/vasm")
-changelog="slack-changes"
-_hgrepo="pierce_jason"
-#_hgrepo="m0e_lnx"
-source=("https://bitbucket.org/$_hgrepo/vasm/get/$pkgver.tar.bz2"
-	"sudoers.d-vasm"
-	"vasm.desktop"
-	"vasm-tui.desktop")
-sha256sums=('ed8f036dadec3d9b1d2d1e58b316c05dd46e3b410817b449bccc1556b25fb9de'
-            'f3cf56b9a9e8578176ca64d5c69e2d8ddec4aa24a9278167a85d9bf915f21bab'
-            'cd5f2fd8ea9f73680683bdb1cae9857a2c02697efcdb54be8848a53d01ac94c1'
-            '5615e41705b84bf180ed95d6308db8b7a818ea153302bbcf3be12839b698e11a')
-build() {
-	python -m compileall .; # Pre-generate .pyc files.
-}
-package() {
-	cd $srcdir/$_hgrepo-$pkgname-$pkgver;
-	
-	mkdir -p $pkgdir/usr/share/$pkgname-$pkgver;	
-	cp *.{py,pyc} $pkgdir/usr/share/$pkgname-$pkgver/;
-	cp -a modules $pkgdir/usr/share/$pkgname-$pkgver/
-	
-	mkdir -p $pkgdir/usr/bin;
-	install -m755 vasm $pkgdir/usr/bin/;
-	
-	mkdir -p $pkgdir/usr/doc/$pkgname-$pkgver;
-	cp *.txt $pkgdir/usr/doc/$pkgname-$pkgver;
-	cp -a AUTHORS COPYING ChangeLog Credits MANIFEST README TODO \
-		$pkgdir/usr/doc/$pkgname-$pkgver/ 2>/dev/null || true;
-
-
-	cd $srcdir;
-	install -d -m700 $pkgdir/etc/sudoers.d
-	install -m400 sudoers.d-vasm $pkgdir/etc/sudoers.d/
-	
-	mkdir -p $pkgdir/usr/share/applications;
-	cp *.desktop $pkgdir/usr/share/applications/;
-}
-
-cat > /dev/null << 'EndofComment' 
-package() {
-	cd "$srcdir/$pkgname-$pkgver"
-	python setup.py install --root="$pkgdir/" --optimize=1;
-}
-EndofComment

File build/PKGBUILD.devel

-# Contributor: pierce.jason [VL7]
-
-pkgname=pyVasm-devel
-pkgver=0.0.99
-pkgrel=1
-pkgdesc="Update helper for pyVasm development tree."
-arch=('any')
-url="https://bitbucket.org/m0e_lnx/vasm/"
-license=('GPL')
-depends=('mercurial' 'urwid' 'pyparted' 'python-pexpect' 'psutil' 'sh' )
-ADDRB='mercurial, urwid, pyparted, python-pexpect, psutil, sh'
-install=
-options=(emptydirs)
-source=("pyVasm-helper.sh")
-sha256sums=('64fbf66e34676a8a4365b48555a9b5773fad2b9f992ec30a2e3613e5b2b075d6')
-
-package() {
-	cd $srcdir
-	mkdir -p $pkgdir/opt/$pkgname;
-	mkdir -p $pkgdir/usr/bin
-	
-	chmod 755 pyVasm-helper.sh;
-	cp pyVasm-helper.sh $pkgdir/usr/bin/;
-	ln -s /usr/bin/pyVasm-helper.sh $pkgdir/usr/bin/pyVasm
-}

File build/slack-changes

-* 7.0-noarch-3vl70
-	- Remove etc/sudoers for real this time. Forgot to do the rm on 2vl70.
-	- (* Note prior changes *)
-* 7.0-noarch-2vl70
-	- Fix sudo misconfiguration leading to local privilege escalation. Sudo access to vasm changed from group "users" to group "sys".
-	- Removed etc/sudoers file from package.
-	- Moved sudo configs related to this package into etc/sudoers.d/vasm
-	- (* Security fix *)
-	- pkg://vlconfig2
-	- http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-FAKECVE
-	- http://helic.wholebean.info/~pierce.jason/sudoers-vuln.txt

File build/slack-suggests

-gparted
-vasm-legacy

File build/sudoers.d-vasm

-# sudoers.d-vasm-0.2
-Cmnd_Alias VASM-LEGACY=/bin/vasm-legacy,/sbin/vasm-legacy,/sbin/vlapt
-Cmnd_Alias VASM=/usr/bin/vasm
-
-# Anyone in the group 'adm'(administrative special privs) can run some programs with a password.
-%adm ALL=VASM,VASM-LEGACY,HW2

File build/vasm-devel.sh

-#!/bin/sh
-SELF=$(basename $0 | cut -d. -f1)
-helper_ver="0.1"
-
-usage() {
-cat <<HELP
-$SELF - Update helper for ${pkgname%-devel} development tree.
-Handles update checking and launches ${pkgname%-devel}. Any options after a double
-dash -- are passed unmodified to the ${pkgname%-devel} subprocess.
-ver. $helper_ver
-
-Usage: $SELF [-u] [-h]
-Usage: $SELF [-a] [-l] [VASM UI] -- [VASM OPTS]
-
-Options:
-	-a, --alternate_source <mercurial repo>
-		Use alternate source repo for updates.
-		Default: $hg_url
-		NOTE: Option not current implemented.
-	-h,  --help
-		Output this help message.
-	-l, --library
-		Start helper in shell library mode. Do not run any functions.
-		Allow functions and variables to be sourced into an
-		interactive POSIX environment.
-	-u, --update
-		Run update checks then exit.	
-		
-VASM UI selects the user interface. If not specified, auto-selection is
-based on presence of running Xorg(env DISPLAY). Usually resulting in GUI.
-
-Valid VASM UI choices:
-	tui
-		Text user interface, utilizing urwid display toolkit.
-	gui
-		Graphical user interface, utilizing gtk display toolkit.
-HELP
-}
-
-
-#####################  Configuration  #####################
-
-pkgname="vasm-devel"
-pkgdir="/opt/$pkgname" # Location of files on disk
-hg_url="https://bitbucket.org/m0e_lnx/vasm" # Where to clone/pullfrom
-change_file=".hg/last_pull" # File for checking last pull
-update_timeframe="4"; # 4 days between update checks
-	
-#####################  Functions  #####################
-
-# Ensures directory exists and repo has been cloned.
-startup_verification() {
-	if [ ! -d "$pkgdir" ]; then
-		echo "Directory $pkgdir does not exist.";
-		echo -e "This should have been created by package install.\nExiting.";	
-		exit;
-	fi;
-	
-	cd $pkgdir;
-	
-	if [ ! -d "$pkgdir/.hg" ]; then
-		echo "Directory $pkgdir/.hg does not exist.";
-		echo "Devel repo not initialized. Cloning now.";
-		
-		hg clone $hg_url $pkgdir/; local hg_ret=$?;
-		touch_change_file $hg_ret;
-	fi;
-}
-
-# List files changed since last update.
-# Run between pull and update commands.
-show_changed() {
-	hg status --rev . --rev tip;
-}
-
-# Update the timestamp on our change_file.
-# First check if any problems pulling (hg_ret).
-touch_change_file() {
-	local hg_ret=$1;
-
-	if [ "$hg_ret" -gt "0" ]; then
-		echo "Problem pulling updates. hg returned status $hg_ret";
-		exit 1;
-	else
-		# 'Touch' the change_file.
-		echo "Do not remove." > $pkgdir/$change_file; 
-	fi;
-}
-
-# See if our check_file dates indicate a need to update.
-# Turn dates 2011-10-18* into 20111018 for doing math.
-# Prompt before checking for updates.
-need_updates() {
-	local last_pull;
-	local today;
-	local difference;
-	
-	if [ -f $pkgdir/$change_file ]; then
-		last_pull=$( stat -c%y $pkgdir/$change_file | cut -d " " -f1 | sed "s/-//g" );
-	else
-		get_updates;
-		return;
-	fi;
-	
-	today=$( date +%F | sed "s/-//g" );
-	difference=$(( $today - $last_pull ));
-	if [ "$difference" -gt "$update_timeframe" ]; then
-		echo "Time to check for updates. Run \`hg pull\` now? [Y/n]";
-		read confirm;
-		if [ "$confirm" != "n" ]; then
-			get_updates;
-			return;
-		else
-			echo "Update check aborted. You can do this at any time by running \`hg pull && hg update\`.";
-			return;
-		fi;
-	else
-		echo "Less than $update_timeframe days since last check. Not doing automatic update.";
-		echo "You can force update at any time by running \`$SELF -u\`.";
-	fi;
-}
-
-# Pull and display updates. Update change_file timestamp.
-# Prompt before merging updates into filesystem.
-get_updates() {
-	hg pull; local hg_ret=$?;
-	touch_change_file $hg_ret;
-	show_changed;
-	echo "Merge these changes? [Y/n]";
-	read confirm;
-	if [ "$confirm" != "n" ]; then
-		hg update;
-	else
-		echo "Merge aborted. You can do this at any time by running \`hg update\`.";
-	fi;
-}
-
-choose_ui() {
-	local ui_choice;
-	local ui_command;
-	
-	if [ -z "$1" ]; then
-		if [ -z "$DISPLAY" ]; then
-			ui_choice="tui";
-		else
-			ui_choice="gui";
-		fi;
-	else
-		ui_choice="$1";
-	fi;
-	
-	case "$1" in
-		tui	) ;;
-		gui	) ;;
-		*	) echo "Unknown ui selected: $ui_choice. If this is really what you want, try passing it directly to ${pkgname%-devel}."
-	esac;
-	
-	echo "Running ${pkgname%-devel} with selected UI: $ui_choice." > /dev/stderr;
-	echo $ui_command;
-}
-
-main() {
-	local ui_cmd;
-	
-	# Make sure we have a directory and a repo in place.
-	startup_verification;
-	
-	# Check timestamps to see if we need to try to update.
-	need_updates;	
-	
-	ui_cmd=$( choose_ui $1 );
-	
-	echo "python2 $ui_cmd";
-	python2 $ui_cmd;
-	exit 0;
-}
-
-#####################  Dispatcher code	#####################
-
-if [ -z "$1" ]; then
-	main;
-fi;
-
-until [ -z "$1" ]; do
-	case "$1" in
-		-a | --alternate_source ) hg_url="$2"; shift;;
-		-l | --library ) DO='';;
-		-u | --update ) startup_verification; DO="get_updates";;
-		-h | --help | -* ) usage; exit;;
-		* ) DO="main $1";;
-	esac;
-	shift;
-done;
-
-eval "$DO";

File build/vasm-tui.desktop

-[Desktop Entry]
-Comment[en_US]=VASM Text User Interface
-Comment=VASM Text User Interface
-Exec=/usr/bin/vasm -i tui
-GenericName[en_US]=VL Administration & System Menu
-GenericName=VL Administration & System Menu
-Icon=package-utilities
-MimeType=
-Name[en_US]=VASM (TUI)
-Name=VASM (TUI)
-Path=
-StartupNotify=true
-Terminal=true
-TerminalOptions=
-Type=Application
-Categories=Application;System;Utilities
-X-DBUS-ServiceName=
-X-DBUS-StartupType=
-X-KDE-SubstituteUID=false
-X-KDE-Username=

File build/vasm.desktop

-[Desktop Entry]
-Comment[en_US]=VASM Graphical User Interface
-Comment=VASM Graphical User Interface
-Exec=/usr/bin/vasm
-GenericName[en_US]=VL Administration & System Menu
-GenericName=VL Administration & System Menu
-Icon=package-utilities
-MimeType=
-Name[en_US]=VASM (GUI)
-Name=VASM (GUI)
-Path=
-StartupNotify=true
-Terminal=false
-TerminalOptions=
-Type=Application
-Categories=Application;System;Utilities
-X-DBUS-ServiceName=
-X-DBUS-StartupType=
-X-KDE-SubstituteUID=false
-X-KDE-Username=

File setup.py

View file
     version = version,
     description = "VetorLinux's Administration & System Menu",
     classifiers = [
-        'Development Status :: 4 - Beta',
+        'Development Status :: 5 - Alpha',
         'Intended Audience :: End Users, System Administrators',
         'License :: GNU GPL Version 3',
         'Topic :: System Administration',
     author_email = __author_email__,
     url = 'http://bitbucket.org/m0e_lnx/vasm',
     license = 'GNU GPL v3',
-    packages = ['vasm', 'vasm.backend', 'vasm.ui', 'vasm.ui.gtk2', 'vasm.ui.urwid'],
-    package_dir={'vasm':'src/vasm/'},
+    packages = ['vasm', 'vasm.backend', 'vasm.ui', 
+                'vasm.ui.gtk2', 'vasm.ui.tui',
+                'vasm.ui.gtk2.modules', 'vasm.ui.gtk2.support',
+                'vasm.ui.tui.modules', 'vasm.ui.tui.support'],
+    package_dir={'vasm' : 'src/vasm/'},
     data_files=[
         ('/usr/share/pixmaps',['src/vasm/data/vasm.png']),
         ('/usr/share/applications', ['src/vasm/data/vasm.desktop',
             'src/vasm/data/vasm-tui.desktop'],
         ),
-        ('/usr/share/vasm/data', ['src/vasm/data/login_gdm.png',
+        ('/usr/share/vasm', ['src/vasm/data/LICENSE',
+            'src/vasm/data/bootmenu.png',
+            'src/vasm/data/bootmode.png',
+            'src/vasm/data/category_graphical_environment.png',
+            'src/vasm/data/category_hardware.png',
+            'src/vasm/data/category_networking.png',
+            'src/vasm/data/category_personal.png',
+            'src/vasm/data/category_startup_options.png',
+            'src/vasm/data/category_system.png',
+            'src/vasm/data/category_unknown.png',
+            'src/vasm/data/datetime.png',
+            'src/vasm/data/gdmconfig.png',
+            'src/vasm/data/gparted.svg',
+            'src/vasm/data/gui_desktop.png',
+            'src/vasm/data/harddisk.png',
+            'src/vasm/data/hardinfo.png',
+            'src/vasm/data/kdmconfig.png',
+            'src/vasm/data/login_gdm.png',
             'src/vasm/data/login_kdm.png',
             'src/vasm/data/login_unknown.png',
             'src/vasm/data/login_xdm.png',
+            'src/vasm/data/package-utilities.png',
+            'src/vasm/data/servicehelp.txt',
+            'src/vasm/data/setup_logging.sh',
+            'src/vasm/data/terminal.png',
+            'src/vasm/data/users.png',
+            'src/vasm/data/vasm.png',
             'src/vasm/data/vasmcc-logo.png',
             'src/vasm/data/vasmcc-logo_trimmed.png',
             'src/vasm/data/vectorlinux-logo.png',
-            'src/vasm/data/LICENSE',
-            'src/vasm/data/servicehelp.txt',
-            'src/vasm/data/setup_logging.sh']),
-        ('/usr/share/vasm/data/icons', ['src/vasm/data/icons/bootmenu.png',
-            'src/vasm/data/icons/bootmode.png',
-            'src/vasm/data/icons/category_graphical_environment.png',
-            'src/vasm/data/icons/category_hardware.png',
-            'src/vasm/data/icons/category_networking.png',
-            'src/vasm/data/icons/category_personal.png',
-            'src/vasm/data/icons/category_startup_options.png',
-            'src/vasm/data/icons/category_system.png',
-            'src/vasm/data/icons/category_unknown.png',
-            'src/vasm/data/icons/datetime.png',
-            'src/vasm/data/icons/gdmconfig.png',
-            'src/vasm/data/icons/gparted.svg',
-            'src/vasm/data/icons/gui_desktop.png',
-            'src/vasm/data/icons/harddisk.png',
-            'src/vasm/data/icons/hardinfo.png',
-            'src/vasm/data/icons/kdmconfig.png',
-            'src/vasm/data/icons/package-utilities.png',
-            'src/vasm/data/icons/terminal.png',
-            'src/vasm/data/icons/users.png',
-            'src/vasm/data/icons/xfce.png',
-            'src/vasm/data/icons/xscreensaver.xpm']),            
-            ],
+            'src/vasm/data/xfce.png',
+            'src/vasm/data/xscreensaver.xpm'])],
+##        ('/usr/share/vasm',['src/vasm/data/*.png',
+##            'src/vasm/data/icons/*.*'])],
+##        ('/usr/share/vasm/data', ['src/vasm/data/login_gdm.png',
+##            'src/vasm/data/login_kdm.png',
+##            'src/vasm/data/login_unknown.png',
+##            'src/vasm/data/login_xdm.png',
+##            'src/vasm/data/vasmcc-logo.png',
+##            'src/vasm/data/vasmcc-logo_trimmed.png',
+##            'src/vasm/data/vectorlinux-logo.png',
+##            'src/vasm/data/LICENSE',
+##            'src/vasm/data/servicehelp.txt',
+##            'src/vasm/data/setup_logging.sh']),
+##        ('/usr/share/vasm/data/icons', ['src/vasm/data/icons/bootmenu.png',
+##            'src/vasm/data/icons/bootmode.png',
+##            'src/vasm/data/icons/category_graphical_environment.png',
+##            'src/vasm/data/icons/category_hardware.png',
+##            'src/vasm/data/icons/category_networking.png',
+##            'src/vasm/data/icons/category_personal.png',
+##            'src/vasm/data/icons/category_startup_options.png',
+##            'src/vasm/data/icons/category_system.png',
+##            'src/vasm/data/icons/category_unknown.png',
+##            'src/vasm/data/icons/datetime.png',
+##            'src/vasm/data/icons/gdmconfig.png',
+##            'src/vasm/data/icons/gparted.svg',
+##            'src/vasm/data/icons/gui_desktop.png',
+##            'src/vasm/data/icons/harddisk.png',
+##            'src/vasm/data/icons/hardinfo.png',
+##            'src/vasm/data/icons/kdmconfig.png',
+##            'src/vasm/data/icons/package-utilities.png',
+##            'src/vasm/data/icons/terminal.png',
+##            'src/vasm/data/icons/users.png',
+##            'src/vasm/data/icons/xfce.png',
+##            'src/vasm/data/icons/xscreensaver.xpm']),            
+##            ],
     requires = ['psutil','urwid','parted','pexpect','shutil'],
-    scripts = ['src/vasm.py'])
+    scripts = ['src/vasm/vasm'])

File src/vasm.py

-#!/usr/bin/env python
-
-#    This file is part of VASM.
-#
-#    VASM is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v3 as published by
-#    the Free Software Foundation.
-#
-#    VASM is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
-
-__author__ = "Moises Henriquez"
-__author_email__ = "moc.liamg@xnl.E0M"[::-1]
-
-# vasm launcher script.
-import os
-import logging
-import logging.handlers
-from optparse import OptionParser
-
-def start_logger():
-    logger = logging.getLogger('vasm')
-    hdlr = logging.handlers.SysLogHandler(address='/dev/log', facility='local0')
-    #formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
-    formatter = logging.Formatter('%(levelname)s %(message)s')
-    hdlr.setFormatter(formatter)
-    logger.addHandler(hdlr)
-    logger.setLevel(logging.ERROR)
-
-def get_logger_level(level):
-    """ return the proper logger level for the specified level"""
-    levels = {'0':logging.CRITICAL,
-        '1':logging.FATAL,
-        '2':logging.ERROR,
-        '3':logging.INFO,
-        '4':logging.DEBUG}
-    return levels[level] or levels['4']
-
-def launch_tui():
-    from vasm.ui.urwid import tvasm
-    logger.debug("Starting VASM urwid ui for uid=%s"% os.geteuid())
-    return tvasm.main()
-
-def launch_gui():
-    from vasm.ui.gtk2 import panedui
-    logger.debug("Starting VASM GTK+2 ui for uid=%s"% os.geteuid())
-    return panedui.main()
-
-def main():
-    if os.getenv("DISPLAY"):
-        return launch_gui()
-    return launch_tui()
-
-if __name__ == "__main__":
-     # process commandline options
-    start_logger()
-    logger = logging.getLogger('vasm')
-    parser = OptionParser()
-    parser.add_option("-v", "--verbose", dest="verbose",
-                      help = "Verbosity level [ 0 - 4 ].")
-    parser.add_option('-i','--interface', dest='interface',
-                      help=''.join(('Interface to be  launched [ gui or tui ].', '  '
-                                   'If nothing is specified, it will default to whatever is available')))
-    (options, args) = parser.parse_args()
-    
-    if options.verbose is not None:
-        logger.setLevel(get_logger_level(options.verbose))
-    if options.interface is None:
-        main()
-    elif options.interface == 'tui':
-        launch_tui()
-    elif options.interface == 'gui':
-        launch_gui()
-    

File src/vasm/backend/utils.py

View file
 
 __author__ = "Moises Henriquez"
 __author_email__ = "moc.liamg@xnl.E0M"[::-1]
-
-if os.path.exists('/usr/share/vasm/data'):
-    datapath = '/usr/share/vasm/data'
-else:
-    datapath = os.path.join(os.path.dirname(os.path.dirname((__file__))), 'data')
+__vasm_version__ = '3.0a1'
+datapath = '/usr/share/vasm'
 
 def _(txt):
     return txt

File src/vasm/data/bootmenu.png

Added
New image

File src/vasm/data/bootmode.png

Added
New image

File src/vasm/data/category_graphical_environment.png

Added
New image

File src/vasm/data/category_hardware.png

Added
New image

File src/vasm/data/category_networking.png

Added
New image

File src/vasm/data/category_personal.png

Added
New image

File src/vasm/data/category_startup_options.png

Added
New image

File src/vasm/data/category_system.png

Added
New image

File src/vasm/data/category_unknown.png

Added
New image

File src/vasm/data/datetime.png

Added
New image

File src/vasm/data/gdmconfig.png

Added
New image

File src/vasm/data/gparted.svg

View file
Added
New image

File src/vasm/data/gui_desktop.png

Added
New image

File src/vasm/data/harddisk.png

Added
New image

File src/vasm/data/hardinfo.png

Added
New image

File src/vasm/data/icons/bootmenu.png

Removed
Old image

File src/vasm/data/icons/bootmode.png

Removed
Old image

File src/vasm/data/icons/category_graphical_environment.png

Removed
Old image

File src/vasm/data/icons/category_hardware.png

Removed
Old image

File src/vasm/data/icons/category_networking.png

Removed
Old image

File src/vasm/data/icons/category_personal.png

Removed
Old image

File src/vasm/data/icons/category_startup_options.png

Removed
Old image

File src/vasm/data/icons/category_system.png

Removed
Old image

File src/vasm/data/icons/category_unknown.png

Removed
Old image

File src/vasm/data/icons/datetime.png

Removed
Old image

File src/vasm/data/icons/gdmconfig.png

Removed
Old image

File src/vasm/data/icons/gparted.svg

Removed
Old image

File src/vasm/data/icons/gui_desktop.png

Removed
Old image

File src/vasm/data/icons/harddisk.png

Removed
Old image

File src/vasm/data/icons/hardinfo.png

Removed
Old image

File src/vasm/data/icons/kdmconfig.png

Removed
Old image

File src/vasm/data/icons/package-utilities.png

Removed
Old image

File src/vasm/data/icons/terminal.png

Removed
Old image

File src/vasm/data/icons/users.png

Removed
Old image

File src/vasm/data/icons/xfce.png

Removed
Old image

File src/vasm/data/icons/xscreensaver.xpm

Removed
Old image

File src/vasm/data/kdmconfig.png

Added
New image

File src/vasm/data/package-utilities.png

Added
New image

File src/vasm/data/terminal.png

Added
New image

File src/vasm/data/users.png

Added
New image

File src/vasm/data/xfce.png

Added
New image

File src/vasm/data/xscreensaver.xpm

View file
Added
New image

File src/vasm/ui/gtk2/modules/aboutsystem.py

View file
     run_hardinfo()
 
 VASM_CATEGORY = "%s/%s"% (_("System"), _("Hardware"))
-VASM_ICON = os.path.join(datapath, 'icons', 'hardinfo.png')
+VASM_ICON = os.path.join(datapath, 'hardinfo.png')
 VASM_LABEL=_("System Information")

File src/vasm/ui/gtk2/modules/bootloaders.py

View file
 
 VASM_CATEGORY = "%s/%s"% (_("System"), _("Startup Options"))
 VASM_LABEL=_("System Boot Menu")
-VASM_ICON = os.path.join(datapath, 'icons', 'bootmenu.png')
+VASM_ICON = os.path.join(datapath, 'bootmenu.png')

File src/vasm/ui/gtk2/modules/bootmode.py

View file
 
 # vasm flags
 VASM_CATEGORY = "%s/%s"% (_("System"), _("Startup Options"))
-VASM_ICON = os.path.join(datapath, 'icons', 'bootmode.png')
+VASM_ICON = os.path.join(datapath, 'bootmode.png')
 VASM_LABEL=_("Startup Mode")
 
 def __vasm_test__():

File src/vasm/ui/gtk2/modules/dateset.py

View file
 
 
 VASM_CATEGORY = _("System")
-VASM_ICON = os.path.join(datapath, 'icons', 'datetime.png')
+VASM_ICON = os.path.join(datapath, 'datetime.png')
 VASM_LABEL=_("Date / Time Settings")
 

File src/vasm/ui/gtk2/modules/disks_utility.py

View file
 
 
 VASM_CATEGORY = "%s/%s"% (_("System"),_("Hardware"))
-VASM_ICON = os.path.join(datapath, 'icons', 'harddisk.png')
+VASM_ICON = os.path.join(datapath, 'harddisk.png')
 VASM_LABEL=_("Hard Disks")
 

File src/vasm/ui/gtk2/modules/filesystems.py

View file
     run_gparted()
 
 VASM_CATEGORY = "%s/%s"% (_("System"), _("Hardware"))
-VASM_ICON = os.path.join(datapath, 'icons', 'gparted.svg')
+VASM_ICON = os.path.join(datapath, 'gparted.svg')
 VASM_LABEL=_("System Partitions")

File src/vasm/ui/gtk2/modules/gdmsetup.py

View file
 
 
 VASM_CATEGORY = "%s/%s"% (_("System"), _("Graphical Environment"))
-VASM_ICON = os.path.join(datapath, 'icons', 'gdmconfig.png')
+VASM_ICON = os.path.join(datapath, 'gdmconfig.png')
 VASM_LABEL=_("Gnome Login Manager Setup")

File src/vasm/ui/gtk2/modules/pyfstab.py

View file
 
 VASM_CATEGORY = "%s/%s"% (_("System"), _("Startup Options"))
 VASM_LABEL=_("Mount Points")
-VASM_ICON = os.path.join(datapath, 'icons', 'harddisk.png')
+VASM_ICON = os.path.join(datapath, 'harddisk.png')
 
 
 def __vasm_test__():

File src/vasm/ui/gtk2/modules/screensaver.py

View file
     run_screensaver_config()
 
 VASM_CATEGORY = "%s/%s"% (_("Personal"), _("Graphical Environment"))
-VASM_ICON = os.path.join(datapath, 'icons', 'xscreensaver.xpm')
+VASM_ICON = os.path.join(datapath, 'xscreensaver.xpm')
 VASM_LABEL=_("Screensaver")
 
 

File src/vasm/ui/gtk2/modules/services.py

View file
 import os
 from vasm.ui.gtk2.support import widgets, dialogs
 from vasm.backend import SERVICES
-from vasm.backend.utils import _
+from vasm.backend.utils import _, datapath
 import gtk
 import gobject
 import threading
         dia = gtk.Dialog(parent=self._parent, title=_("System Services Help"))
         dia.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CANCEL)
         buffer = gtk.TextBuffer()
-        helpfile = os.path.join(os.getcwd(),
-                                "modules","support", "data", "servicehelp.txt")
+        helpfile = os.path.join(datapath, 'servicehelp.txt')
         f = open(helpfile, 'r')
         data = f.readlines()
         f.close()

File src/vasm/ui/gtk2/modules/usermanage.py

View file
 
 # vasm flags
 VASM_CATEGORY=_("System")
-VASM_ICON=os.path.join(datapath,'icons', 'users.png')
+VASM_ICON=os.path.join(datapath, 'users.png')
 VASM_LABEL=_("Users and Passwords")
 
 class ActionButton(gtk.Button):

File src/vasm/ui/gtk2/modules/xfce.py

View file
     
 
 VASM_CATEGORY = "%s/%s"% (_("Personal"), _("Graphical Environment"))
-VASM_ICON = os.path.join(datapath, 'icons', 'xfce.png')
+VASM_ICON = os.path.join(datapath, 'xfce.png')
 VASM_LABEL=_("XFCE4 Settings")

File src/vasm/ui/gtk2/panedui.py

View file
 
 def get_category_image(category):
     """ Returns the path or icon name for the category provided """
-    iconsdir = os.path.join(utils.datapath, 'icons')
+    iconsdir = utils.datapath
     caticon = os.path.join(iconsdir, "category_%s.png"% category.lower().replace(" ", "_"))
     generic = os.path.join(iconsdir, "category_unknown.png")
     if os.path.exists(caticon):
         self.discover_modules()
         self.add_subcategory_launchers()
         self.set_title("VASM")
-        iconpath = os.path.join(utils.datapath, 'icons', 'package-utilities.png')
+        iconpath = os.path.join(utils.datapath, 'package-utilities.png')
         self.set_icon_from_file(iconpath)
         pane = gtk.HPaned()
         pane.set_position(130)

File src/vasm/ui/gtk2/support/dialogs.py

View file
 
 import gtk
 import os
+from vasm.backend.utils import datapath, __vasm_version__
 
 __author__ = "Moises Henriquez"
 __author_email__ = "moc.liamg@xnl.E0M"[::-1]
 class AboutVASM(gtk.AboutDialog):
     """ About window for vasm """
     def __init__(self, parent):
-        
         gtk.AboutDialog.__init__(self)
         self.set_name("VASM")
-        self.set_version("2.0")
+        self.set_version(__vasm_version__)
         self.set_copyright("Copyright 2011 Moises Henriquez")
-        f = open(os.path.join(os.getcwd(), "modules/support/data/LICENSE"), "r")
+        f = open(os.path.join(datapath,'LICENSE'),'r')
         license = f.readlines()
         f.close()
         self.set_license("".join(license))
         self.set_logo(
             gtk.gdk.pixbuf_new_from_file_at_size(
-                os.path.join(os.getcwd(), "modules/support/data/vasmcc-logo.png"), 200, 100
+                os.path.join(datapath,'vasmcc-logo.png'), 200,200
             )
         )
         self.set_authors(["Moises Henriquez [ %s ]"% "moc.liamg@xnl.E0M"[::-1],
-                          "Jason Pierce [ %s ]"% "moc.liamg@nosaj.ecreip"[::-1],])
+                        "Jason Pierce [ %s ]"% "moc.liamg@nosaj.ecreip"[::-1],
+                        "Rodrigo Bistolfi [ %s ]"% "moc.liamg@iflotsibr"[::-1],
+                        "Uel Archuletta [ %s ]" % "moc.liamg@s8ksleU"[::-1],])
         self.set_website("https://bitbucket.org/m0e_lnx/vasm")
         self.set_comments("VectorLinux control panel utility.")
         self.set_icon(parent.get_icon())

File src/vasm/ui/tui/__init__.py

View file
+#!/usr/bin/env python
+
+""" Urwid interface for vasm """
+__all__ = ['modules', 'support']

File src/vasm/ui/tui/modules/__init__.py

View file
+""" Module files for the text vasm interface """
+

File src/vasm/ui/tui/modules/tui_aboutvl.py

View file
+#!/usr/bin/env python
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+""" aboutvl.py
+Text mode module to show information about the current vectorlinux installation
+"""
+__author__ = "Moises Henriquez"
+__author_email__ = "moc.liamg@xnl.E0M"[::-1]
+
+
+import urwid
+import sys
+import os
+from vasm.backend import utils
+from vasm.ui.tui.support import dialogs, widgets
+
+_=utils._
+
+VASM_CATEGORY = "System"
+VASM_LABEL = "About VectorLinux"
+
+
+class AboutVL(widgets.TuiModule):
+    """ Show dialog about vl """
+    def __init__(self, parent):
+        self.parent = parent
+        info = {
+            "VectorLinux Version: ": utils.get_vector_version(),
+            "System Base: ": utils.get_slack_base(),
+            "Release Date: ": utils.get_release_date(),
+            "Running Kernel Version: ": os.uname()[2],
+            "System Architecture: ": os.uname()[-1],
+            "Hostname: ": os.uname()[1],
+      }
+        body = []
+        body.append(widgets.blank)
+        for item in info:
+           wrap = urwid.AttrWrap(
+               urwid.Text("%s %s"% ( item, info[item])), 'body'
+           )
+           body.append(wrap)
+        body.append(urwid.Divider())
+        body.append(urwid.AttrWrap(
+            urwid.Text("www.vectorlinux.com"), 'body'))
+        widgets.TuiModule.__init__(self,
+                                      header="About VectorLinux",
+                                      desc = ["",_("Information about your vectorlinux system.")],
+                                      body = body,
+                                      buttons = [("Back", self.close_module)],
+                                      parent=self.parent)
+        
+        self.body = urwid.LineBox(self.get_body())
+    
+    def return_to_module(self, widget=None, data=None):
+        """ REturn to this module from another dialog.
+        
+        Modules that do not have child dialogs, may just reuturn return_home"""
+        return self.return_home(widget)
+
+def __vasm_test__():
+    return True
+
+
+def __run__(parent_toplevel):
+    mod = AboutVL(parent_toplevel)
+    parent_toplevel.pop_module(mod)
+    
+    

File src/vasm/ui/tui/modules/tui_autologin.py

View file
+#!/usr/bin/env python
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+""" tui_autologin.py
+Text mode module to enable and set automatic login parameters.  GDM must be the
+login manager in use to for this to work.
+
+"""
+__author__ = "Moises Henriquez"
+__author_email__ = "moc.liamg@xnl.E0M"[::-1]
+
+import urwid
+import sys
+import os
+from vasm.backend import LOGINMANAGERS, USERADMIN, GDMHELPER
+from vasm.ui.tui.support import dialogs, widgets
+from vasm.backend.utils import _
+import logging
+
+logger = logging.getLogger('vasm')
+
+VASM_CATEGORY = "Graphical Environment"
+VASM_LABEL = "Automatic Login Settings"
+
+class GdmSetup(dialogs.ModuleDialog):
+    def __init__(self, parent):
+        self.parent = parent
+        self._widgets = []
+        radios = []
+        self.settingsmodel = GDMHELPER.SettingsModel()
+        self._current_state = self.settingsmodel.get_current_autologin_setting()
+        self._current_aluser = self.settingsmodel.get_current_autologin_user()
+        rbNoLogin = urwid.RadioButton(radios,
+                                      _("Disable automatic login."),
+                                      user_data = 'false',
+                                      state = self._current_state == 'false',
+                                      on_state_change = self.autologin_toggle_event)
+        noexp = urwid.Text(" "* 4 + _("Users must enter login name and password."))
+        rbAutoLogin = urwid.RadioButton(radios,
+                                        _("Enable automatic login."),
+                                        user_data = 'true',
+                                        state = self._current_state == 'true',
+                                        on_state_change = self.autologin_toggle_event)
+        yesexp = urwid.Text(" "*4 + _("The following user will be automatically logged in."))
+        
+        self._widgets.extend([urwid.AttrWrap(rbNoLogin, 'button'),
+                     noexp,
+                     urwid.AttrWrap(rbAutoLogin, 'button'),
+                    yesexp])
+        self._logins_picker = self._get_users_list()
+        self._widgets.append(self._logins_picker)
+        dialogs.ModuleDialog.__init__(
+            self,
+            header=_("Automatic Login Settings"),
+            body=self._widgets,
+            desc = [_("Select how users log into the graphical desktop."),"\n"],
+            parent = self.parent,
+            buttons = [
+                ("Save", self.save_settings),
+                ("Back", self.close_module)]
+        )
+        
+        self.set_body(urwid.LineBox(self.get_body()))
+        self._autologin_enabled = self._current_state
+        self._autologin_user = self._current_aluser or 'root'
+
+        # move the focus to the body of the module
+        self.set_focus('body')
+    
+    def save_settings(self, caller_widget=None):
+        """ Make the call to save the settings """
+        xdm_model = LOGINMANAGERS.LoginManagers()
+        # check if gdm is the current login manager.
+        if xdm_model.get_current() != "GDM":
+            # check if gdm is
+            if "GDM" in xdm_model.list_existing():
+                # force gdm
+                xdm_model.set_manager("GDM")
+            else:
+                # throw a dialog because there is no gdm.
+                dia = dialogs.Error(
+                    parent = self.parent,
+                    message = _("The GDM login manger is not found on this system.") + "\n" + \
+                    _("These settings can only be used with the gdm login manager.") + "\n" + \
+                    _("Please install gdm and try again."),
+                    buttons = [("OK", self.close_module)]
+                )
+                return self.pop_dialog(dia)
+
+        try:
+            self.settingsmodel.save_settings(
+                str(self._autologin_enabled),
+                str(self._autologin_user)
+                )
+        except IOError as e:
+            dia = dialogs.Error(
+                parent = self.parent,
+                message = _("There was an error saving the your automatic login preferences.") + "\n" + e,
+                buttons = [("OK", self.close_module)]
+                )
+            logger.error("Error saving automatic login settings: %s"% e)
+            return self.pop_dialog(dia)
+        # Display a success dialog
+        dia = dialogs.Info(
+            parent = self.parent,
+            message = _("Your settings have been successfully saved.") + "\n" + \
+            _("Your changes will take effect after the next system reboot."),
+            buttons = [("OK", self.close_module)]
+            )
+        logger.debug("Saved automatic login settings.")
+        return self.pop_dialog(dia)
+    
+    def autologin_toggle_event(self, radio, newstate, user_data):
+        """ user_data has the corrent setting to be parsed"""
+        if newstate is True:
+            self._autologin_enabled = user_data
+
+    def autologin_user_toggle_event(self, radio, newstate, user_data):
+        """ user_data contains the login name of the selected radio button """
+        if newstate is True:
+            self._autologin_user = user_data
+    
+    def _get_users_list(self):
+        allusers = USERADMIN.UserModel().listUsers()
+        logins = []
+        _names = []
+        for account in allusers:
+            rb = urwid.RadioButton(_names,
+                                   account.login,
+                                   state = self._current_aluser == account.login,
+                                   user_data = account.login,
+                on_state_change = self.autologin_user_toggle_event)
+            w = urwid.AttrWrap(rb, 'button')
+            logins.append(
+                urwid.Columns([('fixed', 6, urwid.Text(" ")), w], 0))
+        box = urwid.Pile(logins)
+        #box = urwid.ListBox(logins)
+        return box
+    
+
+
+def __vasm_test__():
+    return os.geteuid() == 0
+
+
+def __run__(parent):
+    mod = GdmSetup(parent)
+    parent.pop_module(mod)

File src/vasm/ui/tui/modules/tui_bootloaders.py

View file
+#!/usr/bin/env python
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+""" tui_bootloaders.py
+    Text mode module to interact with available bootloaders in the system. """
+
+__author__ = "Moises Henriquez"
+__author_email__ = "moc.liamg@xnl.E0M"[::-1]
+
+import urwid
+import os
+import time
+from vasm.backend import BOOTLOADERS, FSTAB
+from vasm.backend.utils import _
+from vasm.ui.tui.support import widgets, dialogs
+import logging
+
+logger = logging.getLogger('vasm')
+
+class BootloaderTui(dialogs.ModuleDialog):
+    def __init__(self, parent):
+        self.parent = parent
+        bsector = BOOTLOADERS.get_current_bootsector()
+        rootdev = bsector[:len('/dev/sda'):]
+        currentbootloader = BOOTLOADERS.MBR(rootdev).read_bootloader() or \
+            BOOTLOADERS.DEFAULT_BOOTLOADER
+        msg = (
+            _("Select which bootloader you would like to use."), "\n",
+            _("WARNING: this tool will over-write the target you selecct below."), "  ",
+            _("Selecting the wrong options here could render your system unbootable."),)
+        
+        self.blpicker = widgets.HChoiceBox(
+            label = 'Select Bootloader:',
+            choices = [("LILO", 'lilo'), ("GRUB2", 'grub2')],
+            on_state_change = self.blpicker_event,
+            on_focus = self.refresh_module_status_text
+            )
+        self.targetpicker = widgets.LabeledPicker(
+            label = "Installation Target:",
+            picker_title = _("Select the installation target for your bootloader."),
+            options = self._get_valid_targets(currentbootloader),
+            parent = self,
+            on_focus = self.refresh_module_status_text
+            )
+        self.videosizepicker = widgets.LabeledPicker(
+            label = _("Video Resolution:"),
+            picker_title = _("Select the video resolution for your boot screen."),
+            options = self._get_valid_video_sizes(currentbootloader),
+            parent = self,
+            on_focus = self.refresh_module_status_text
+            )
+        self.timeoutspinner = widgets.LabeledSpinner(
+            label = "Timeout (seconds):",
+            default_value=5,
+            range_max = 60,
+            on_focus = self.refresh_module_status_text
+            )
+        actionlabel = urwid.Text(_("Select the action to be performed with your bootloader."))
+        self.actionpicker = widgets.HChoiceBox(
+            label = _("Action:"),
+            choices = [
+                (_("Install and refresh boot menu"),BOOTLOADERS.Install),
+                (_("Refresh boot menu only"), BOOTLOADERS.Refresh)],
+                on_state_change = self.action_toggle_event,
+                on_focus = self.refresh_module_status_text
+            )
+        self.actionpicker.set_value(_("Refresh boot menu only"))
+        
+        _body = [self.blpicker,
+                 self.targetpicker,
+                 self.videosizepicker,
+                 self.timeoutspinner,
+                 widgets.blank,
+                 actionlabel,
+                 self.actionpicker
+                 ]
+        dialogs.ModuleDialog.__init__(
+            self,
+            header = _("System Boot Menu"),
+            desc = [''.join(msg), urwid.Divider('_'),widgets.blank],
+            parent = self.parent,
+            body = _body,
+            buttons = [("Save", self.module_ok_event),
+                ("Cancel", self.parent.return_home)])
+        # Set the default values
+        bootsec = BOOTLOADERS.get_current_bootsector()
+        currentroot = bootsec[:len('/dev/sda'):]
+        mbr_read = BOOTLOADERS.MBR(currentroot).read_bootloader() or "LILO"
+        mbr_read = mbr_read.upper()
+        #mbr_read = BOOTLOADERS.MBR(currentroot).read_bootloader().upper() or "LILO"
+        self.blpicker.set_value(mbr_read)
+        self.populate_pickers(mbr_read)
+        # Move the focus to the body section of the module
+        self.set_focus('body')
+
+    def _check_selections(self):
+        # check if target has a value
+        assert self.targetpicker.get_value().startswith("/"),\
+            ' '.join((
+                _("Select a valid target from the options list."),
+                _("Access the options list by pressing Enter or Space on the selection area")))
+
+    def module_ok_event(self, widget=None):
+        """ Triggered when "Save" is pressed on this module """
+        try:
+            self._check_selections()
+        except AssertionError as e:
+            dia = dialogs.Error(
+                parent = self,
+                message = "%s"% e,
+                buttons = [("OK", self.return_to_module)]
+                )
+            return self.pop_dialog(dia)
+
+        bootloader = self.blpicker.get_value()
+        target = self.targetpicker.get_value()
+        vgasize = self.videosizepicker.get_value()
+        vgaquality = "high" # we are default to 'high'
+        timeout = self.timeoutspinner.get_value()
+        action = self.actionpicker.get_value()
+        dia = dialogs.Question(
+            parent = self,
+            message = ''.join((
+                _("WARNING: You are about to overwrite the bootloader on"), ' ',target,'.  ',
+                _("Are you sure you want to continue?")
+                )),
+            buttons = [
+                ("YES", self._do_write_changes),
+                ("NO", self.return_to_module)
+            ])
+        return self.pop_dialog(dia)
+
+    def _do_write_changes(self, widget=None):
+        # create the bootloader object
+        sloader = self.blpicker.get_value().upper()
+        tgt = self.targetpicker.get_value()
+        timeout = self.timeoutspinner.get_value()
+        vgasize = self.videosizepicker.get_value()
+        vgaquality = "high"
+        action = self.actionpicker.get_value_data()
+        methods = []
+        if sloader == 'LILO':
+            blobject = BOOTLOADERS.LILO(
+                target=tgt,
+                timeout = timeout,
+                vga_size = vgasize,
+                vga_quality = vgaquality,
+                include_running_os=True
+                )
+            methods.append(blobject.install)
+        elif sloader == 'GRUB2':
+            blobject = BOOTLOADERS.GRUB2(
+                target=tgt,
+                timeout=timeout,
+                vga_size=vgasize,
+                vga_quality=vgaquality
+                )
+            if action == BOOTLOADERS.Install:
+                methods.append(blobject.install)
+                methods.append(blobject.refresh_menu)
+            elif action == BOOTLOADERS.Refresh:
+                methods.append(blobject.refresh_menu)
+        # run the changes.  First drop the UI and go to a terminal
+        self.pause_ui()
+        print "Saving changes to %s on %s"% (blobject.type, blobject.target)
+        print "This may take a few seconds... Please wait."
+        for method in methods:
+            try:
+                logger.debug("Running %s"% method.func_name)
+                method()
+            except AssertionError, e:
+                logger.fatal("%s"% e)
+                dia = dialogs.Error(
+                    parent = self,
+                    message = ''.join((
+                        _("The following error was encoutered while saving changes."), '\n\n%s'%e,
+                        '\n\n',_('DO NOT restart your computer until you are sure your bootloder is fine.')
+                        )),
+                    buttons = [("OK", self.return_to_module)]
+                    )
+                self.return_to_module()
+                self.pop_dialog(dia)
+                logger.error("Error while running %s: %s"%(method.func_name, e))
+                return self.resume_ui()
+            time.sleep(1)
+        logger.info('%s updated'% sloader)
+        dia = dialogs.Info(
+            parent = self,
+            message = ''.join((
+                _("Changes saved successfully."), "  ",
+                _("You will see the changes applied the next time the system restarts.")
+                )),
+            buttons = [("OK", self.close_module)]                
+            )
+        self.return_to_module()
+        logger.debug("Bootloader settings saved.")
+        self.pop_dialog(dia)
+        self.resume_ui()
+
+    def do_save_changes(self, widget=None):
+        return self._do_write_changes()
+
+
+    def refresh_module_status_text(self, widget=None):
+        if isinstance(widget, widgets.SensibleLabel):
+            return self.set_status_text('Press Enter/Space to activate')
+        elif isinstance(widget, widgets.TimeSpinner):
+            return self.set_status_text("Use +/- to increate / decrease value")
+        elif isinstance(widget, urwid.RadioButton):
+           return self.set_status_text("Press Enter/Space to select")            
+
+    def action_toggle_event(self, radio=None, new_state=None, user_data=None):
+        pass
+
+    def _get_valid_targets(self, bootloader=BOOTLOADERS.DEFAULT_BOOTLOADER):
+        partitions = FSTAB.list_all_system_partitions()
+        drives = FSTAB.list_all_system_drives()
+        if bootloader.upper() == 'LILO':
+            targets = partitions
+            targets.extend(drives)
+            targets.sort()
+            return targets
+        elif bootloader.upper() == 'GRUB2':
+            targets = drives
+            targets.sort()
+            return targets
+        return []
+
+    def _get_valid_video_sizes(self, bootloader=BOOTLOADERS.DEFAULT_BOOTLOADER):
+        ret = []
+        if bootloader.upper() in ("LILO","GRUB2"):
+            ret = ["600x480","800x600","1024x768", "1280x1024"]
+            return ret
+        return ret
+
+    def _get_valid_video_quality(self, bootloader=BOOTLOADERS.DEFAULT_BOOTLOADER):
+        ret = []
+        if bootloader.upper() == 'LILO':
+            ret = ['low','med','hight']
+        elif bootloader.upper() == 'GRUB2':
+            ret = ['med']
+        return ret
+            
+    
+    def populate_pickers(self, bootloader):
+        # populate the targets.
+        self.targetpicker.set_options(self._get_valid_targets(bootloader))
+        self.videosizepicker.set_options(self._get_valid_video_sizes(bootloader))
+        self.videosizepicker.set_value('800x600')
+        # We want to force the target to reset because we dont want
+        # an invalid (ie, bootsector) value in the target when grub is selected
+        return self.targetpicker.reset_value()        
+
+    def blpicker_event(self, radio=None, new_state=None, user_data=None):
+        if new_state is True:
+            return self.populate_pickers(radio.get_label())
+            dia = dialogs.Info(radio.get_label(), parent=self.parent,
+                                   buttons = [("OK", self.return_to_module)])
+            return self.pop_dialog(dia)
+
+def __vasm_test__():
+    return os.geteuid() == 0
+
+def __run__(parent):
+    mod = BootloaderTui(parent)
+    parent.pop_module(mod)
+
+VASM_CATEGORY = "System"
+VASM_LABEL = "Sytem Boot Menu"

File src/vasm/ui/tui/modules/tui_bootmode.py

View file
+#!/usr/bin/env python
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+""" tui_bootmode.py
+    Text mode module to set the system boot mode """
+
+__author__ = "Moises Henriquez"
+__author_email__ = "moc.liamg@xnl.E0M"[::-1]
+
+import urwid
+import os
+from vasm.backend import BOOTMODE
+from vasm.ui.tui.support import widgets, dialogs
+from vasm.backend.utils import _
+import logging
+
+logger = logging.getLogger('vasm')
+
+VASM_CATEGORY = "System"
+VASM_LABEL = "System Startup Mode"
+
+class Interface(dialogs.ModuleDialog):
+    """ Dialog to set the default system boot mode. """
+    def __init__(self, parent):
+        self.parent = parent
+        self.datamodel = BOOTMODE.InitTab()
+        modes = {2: _("Command line single user mode."),
+                 3: _("Commandline with services enabled for a multi user environment."),
+                 4: _("Graphical desktop.  Recomended for most home users."),
+                 5: _("Graphical desktop with services enaled for multiple users.")}
+        msg = _("Select your default system startup mode.")