Tuesday, January 15, 2013

GDebi: Local deb Installs & Dependencies

Installing a Debian package downloaded locally and trying to install via dpkg -i filename.deb failed because of missing dependencies. dpkg will not download dependencies from the internet for you. You would have to determine what they are and download them, install them, then install the main Debian package. Fun.

Synaptic, apt-get, aptitude, none of them will install (with automatically downloaded dependencies) local packages for you.

Enter GDebi:
gdebi is a simple tool to install deb files. It lets you install local [Debian] packages resolving [downloading, if needed] and installing its dependencies.

Gnome & KDE versions available for Ubuntu:

gdebi: simple tool to install deb files - GNOME GUI
gdebi-core: simple tool to install deb files
gdebi-kde: simple tool to install deb files - KDE GUI
So there you have it. Install gdebi from apt-get, Synaptic, etc. and proceed with your local installs with gdebi. GUI or command line (man gdebi).


Distro: XUbuntu 12.10
GDebi: 0.8.5ubuntu1.1

Saturday, January 12, 2013

Simple Codebox For Blogger

Why doesn't Blogger offer this as a code box formatting option??

I found several different methods that involved modifying your Blogger template by adding CSS code. I tried a few of them without the success I wanted. I did find this easy to use web app that will do what I want, until I decide to go back to messing with my Blogger template again.


Enter your code snippet, select a few options, and it outputs html that you can paste into your post that will do the job. For some reason it seems to add a whitespace to the beginning & two to the end of each line. Otherwise, it will work for me until I want to mess with the CSS thing.

Here's an output example. An interesting looking startup script for Virtualbox (I haven't tested this script however, so YMMV)...


#!/bin/bash

# Copyright Information
# CC License BY-NC-SA 3.0 Unported License (May 11, 2012)
# Charles Auer
# http://charlesa.net/scripts/linux/vboxscript.php

### BEGIN INIT INFO
# Provides:       vmboot
# Required-Start: vboxdrv $local_fs
# Required-Stop:  vboxdrv $local_fs
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Short-Description: Stop/Start VMs before/after System shutdown
### END INIT INFO

# Updated 04/27/2012

# Add this script to /etc/init.d/
# Run "update-rc.d vmboot defaults 99 01" as root

# Written to work with VirtualBox 4.x
# This script will save the state of any running virtual machines.

# User who is running the VMs (Change this!)
VBOXUSER=vboxuser

# Environmental Variables (Do Not Modify!)
SU="sudo -H -u $VBOXUSER"
VBOXMANAGE="/usr/bin/VBoxManage --nologo"
# Get UUID of All Running VMs
# UUID looks like this: a02b5b54-a84d-48fa-8dac-2a3fad55717e
RUNNINGVMS=$($SU $VBOXMANAGE list runningvms | sed -e 's/^".*".*{\(.*\)}/\1/')
# Get UUID of All VMs
ALLVMS=$($SU $VBOXMANAGE list vms | sed -e 's/^".*".*{\(.*\)}/\1/')

# Functions
function getVMName()
{ echo $($SU $VBOXMANAGE list vms | grep "$1" | awk -F\" '{print $(NF -1)}'); }

# Check to ensure $ALLVMS is not null and exit if it is.
if [[ $ALLVMS = "" ]]; then
        echo "No VMs are detected on this host! Did you configure the VBOXUSER variable?"; exit 1
fi

case $1 in
stop)
if [[ -n $RUNNINGVMS ]]; then
        for v in $RUNNINGVMS; do
        echo -e "Saving state of \"$(getVMName $v)\"..." && $SU $VBOXMANAGE controlvm $v savestate
        done; else
        echo "No running VMs to save!"
fi
;;
start)
for v in $ALLVMS; do
        if [[ -n $($SU $VBOXMANAGE showvminfo $v | grep saved) ]]; then
                echo -e "Waiting for VM \"$(getVMName $v)\" to power on..." && $SU $VBOXMANAGE startvm $v --type headless 1> /dev/null && echo "VM \"$(getVMName $v)\" started successfully!"
        fi
# If the previous loop has an error, the loops exits and returns an error.
        if [[ $? -ne 0 ]]; then
                echo "There was an error starting $(getVMName $v)! Try starting it manually to see what the problem is."; break
        fi
done
if [[ -z $($SU $VBOXMANAGE showvminfo $v | grep saved) ]]; then
        echo "No Saved VMs to Start!"
fi
;;
status)
if [[ -n $RUNNINGVMS ]]; then
        echo "List of Running VMs:" && $SU $VBOXMANAGE list runningvms; else
                echo "No VMs Currently Running!"
fi
;;
list)
echo "List of All VMs:" && $SU $VBOXMANAGE list vms
;;
*)
echo "Usage: /etc/init.d/vmboot start | stop | status | list"; exit 1
;;
esac
exit 0
# eof

Samba: Empty .gvfs XUbuntu 12.10

Problem: Unable to navigate to and/or access remote smb (samba) shares via the bash shell.

It seems something changed when I upgraded from XUbuntu 12.04 to 12.10. I used to be able to open gigolo (which was set to automatically mount remote smb shares), and then work with them in bash by navigating to them with:

cd ~/.gvfs
Running an ls command would display all the remote shared folders and away we go

Now, even though the shares are mounted (I can navigate to them with my file manager), there is nothing in ~/.gvfs

Solution: After mounting the remote shares, you will find them under:

/run/user/username/gvfs/smb-share:server=smbServer,share=shareName,user=username

To save time, create symbolic links to the shares (which of course will only work when the share is mounted):

ln -s /run/user/username/gvfs/smb-share:server=smbServer,share=shareName,user=username shareLink

Distro: XUbuntu 12.10
File Manager: Thunar 1.4.0
Samba Connection Manager: gigolo 0.4.1