Commits

Anonymous committed b796f5d Merge

Merge commits from Moe.

  • Participants
  • Parent commits c9f51b5, 9bd49f4
  • Tags 3.0a0.9

Comments (0)

Files changed (8)

File _build/PKGBUILD

 # Contributor: pierce.jason [VL7]
 
 pkgname=vasm
-pkgver=3.0.98.0
-#pkgver=3.0.99.9
+pkgver=3.0a0.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."
+pkgdesc="Vectorlinux's Administration & System Menu (Alpha release). System configuration
+tool for both TUI and GUI. Complete rewrite of vasm with goals to provide
+greater modularity for maintainability and support for localization and
+internationalization, and tighter integration with the distro installer and the
+system itself. The prior vasm (renamed and moved to vasm-legacy) will remain
+installed on the system for your convenience."
 arch=('any')
-url="https://bitbucket.org/m0e_lnx/vasm/wiki"
-license=('GPL')
+url="https://bitbucket.org/m0e_lnx/vasm"
+license=('GPL3')
 depends=( 'python' 'urwid' 'pyparted' 'python-pexpect' 'psutil' 'vasm-legacy' )
 #ADDRB="urwid, pyparted, python-pexpect, psutil, vasm-legacy"
 ADDRB="urwid, pyparted, python-pexpect, psutil"
 changelog="slack-changes"
 _hgrepo="pierce_jason"
 #_hgrepo="m0e_lnx"
+#source=("https://bitbucket.org/$_hgrepo/vasm/downloads/$pkgname-$pkgver.tar.bz2"
 source=("https://bitbucket.org/$_hgrepo/vasm/get/$pkgver.tar.bz2"
-	"sudoers.d-vasm"
-	"vasm.desktop"
-	"vasm-tui.desktop")
+	"sudoers.d-vasm")
+install="doinst.sh"
 sha256sums=('ed8f036dadec3d9b1d2d1e58b316c05dd46e3b410817b449bccc1556b25fb9de'
-            'f3cf56b9a9e8578176ca64d5c69e2d8ddec4aa24a9278167a85d9bf915f21bab'
-            'cd5f2fd8ea9f73680683bdb1cae9857a2c02697efcdb54be8848a53d01ac94c1'
-            '5615e41705b84bf180ed95d6308db8b7a818ea153302bbcf3be12839b698e11a')
+            'f3cf56b9a9e8578176ca64d5c69e2d8ddec4aa24a9278167a85d9bf915f21bab')
 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/;
+	cd $srcdir/$pkgname-$pkgver;
 	
 	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;
-
+	cp src/vasm/data/LICENSE $pkgdir/usr/doc/$pkgname-$pkgver;
 
 	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/;
+	python setup.py install --root="$pkgdir/";
 }
-
-cat > /dev/null << 'EndofComment' 
-package() {
-	cd "$srcdir/$pkgname-$pkgver"
-	python setup.py install --root="$pkgdir/" --optimize=1;
-}
-EndofComment

File _build/doinst.sh

+#!/bin/sh
+/usr/share/vasm/setup_logging.sh;

File _build/vasm-devel.sh

 #!/bin/sh
+# This script by Jason Pierce <echo -e "moc\x2eliamg\x40nosaj.ecreip" | rev>.
+# Licensed as MIT.
 SELF=$(basename $0 | cut -d. -f1)
 helper_ver="0.1"
 
 	main;
 fi;
 
+# TODO: 1) setup logging 2) implement passthrough args 3) implement --alternate_source
 until [ -z "$1" ]; do
 	case "$1" in
 		-a | --alternate_source ) hg_url="$2"; shift;;

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 src/vasm/data/setup_logging.sh

 #!/bin/sh
-logFile="/var/log/vasm.log";
+# This script by Jason Pierce <echo -e "moc\x2eliamg\x40nosaj.ecreip" | rev>.
+# Licensed as MIT.
+SELF=$(basename $0 | cut -d. -f1)
+helper_ver="0.1"
 
-in_use() {
-	local property;
-	property=$1;
-	usingProperty=$( grep -I $property /etc/syslog.conf | sed "s/#.*$//" | sed '/^$/d' | wc -l );
-	if [ "$usingProperty" -gt "0" ]; then
-		# This property is in use.
-		echo true;
+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;
 }
 
-syslog_payload() {
-	local facility;
-	local payload;
-	facility=$1;
-	cat <<EOF
+# List files changed since last update.
+# Run between pull and update commands.
+show_changed() {
+	hg status --rev . --rev tip;
+}
 
-# Vasm centralized logging to facility $facility.
-$facility.*					-$logFile
-EOF
+# 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;
 	
-
-usingVasm=$( in_use "$logFile" );
-if [ $usingVasm ]; then
-	# Vasm logging already setup
-	echo "Logging already configured for $logFile."
-	echo "Doing nothing.";
-	exit 0;
-else
-	echo "Logging not configured for $logFile.";
-	echo "Configuring in /etc/syslog.conf.";
-	usingLocal0=$( in_use "local0" );
-	if [ $usingLocal0 ]; then
-		# Something else is using 'local0'
-		echo "Logging facility 'local0' already in use."
-		echo "Checking for 'local1' now.";
-		usingLocal1=$( in_use "local1" );
-		if [ $usingLocal1 ]; then
-			# Something else is using 'local1';
-			echo "Logging facility 'local1' already in use.";
-			echo "Aborting configuration of /etc/syslog.conf.";
-			echo "Please configure manually for vasm logging.";
+	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
-			# We can use 'local1'.
-			facility="local1";
+			echo "Update check aborted. You can do this at any time by running \`hg pull && hg update\`.";
+			return;
 		fi;
 	else
-		# We can use 'local0'.
-		facility="local0";
+		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;
 	
-	# Write our conf lines to syslog config file.
-	syslog_payload $facility >> /etc/syslog.conf;
-	echo "Configured with facility=$facility logfile=$logFile.";
+	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;
+
+# TODO: 1) setup logging 2) implement passthrough args 3) implement --alternate_source
+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 src/vasm/data/vasm-tui.desktop

 Exec=/usr/bin/vasm -i tui
 GenericName[en_US]=VL Administration & System Menu
 GenericName=VL Administration & System Menu
-Icon=package-utilities
-MimeType=
+Icon=/usr/share/pixmaps/vasm.png
 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 src/vasm/data/vasm.desktop

 Exec=/usr/bin/vasm
 GenericName[en_US]=VL Administration & System Menu
 GenericName=VL Administration & System Menu
-Icon=package-utilities
-MimeType=
+Icon=/usr/share/vasm/vasm.png
 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=