Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Friday, July 13, 2012

ubuntu 12.04 precise: automated installation, preseeding

To get you started: https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html

I had never done this before, and had great fun getting it to work. I was installing from a USB thumb drive. So I made of those guys per usual. The help page then says

"... you need to tell the installer what file to use when you boot it. This is normally done by passing the kernel a boot parameter, either manually at boot time or by editing the bootloader configuration file (e.g. syslinux.cfg) and adding the parameter to the end of the append line(s) for the kernel."

Since we're automating this, editing syslinux.cfg seemed to be the way to go. However, taking a look at that guy, there was no append line. Sad face. I added a kernel and append line, but it wasn't changing the boot parameters. I then came across /syslinux/txt.cfg, which had what looked like the boot prompt being used. So I changed the append line there to include "preseed/file=/hd-media/preseed.cfg". Error, "Failed to retrieve the preconfiguration file". I changed this to "preseed/file=/cdrom/preseed.cfg".. and voila!

Some other newb notes:

  • If the installer stops to ask you a question, you can press escape and a menu with lots of options will popup. You can abort the installation from here.

Tuesday, January 3, 2012

ubuntu chromium flash killing tabs

So sometimes when flash dies, like any good gift, it continues giving in the form of freezing any subsequent page that has flash. I tried killing the flash plugin process via the browser but that didn't seem to help; however, when killing the process from a terminal my browser was back to normal! Huzzah!

ps -ef | grep chromium-browser | grep flashplugin | awk '{print $2}' | xargs kill

Sunday, October 23, 2011

ubuntu oneiric ocelot write desktop background image file

here is a script which takes in path to one or more directories containing images and writes a gnome desktop background file to show those images

#!/bin/bash

usage()
{
cat << EOF
usage: $0 -t transition_time -s static_time (-d dirs|-r recursive_dirs)

OPTIONS:
 -h      Show this message
 -t      required. time of transition between images, in seconds
 -s      required. time each image is show
 -d      comma separated list of directories containing images.
 -r      comma separated list of directories that contain images and
         other directories with more images

Either dirs, recursive_dirs, or both is required
EOF
if [[ -z $1 ]]; then exit 1; else exit $1; fi
}

set_img_paths()
{
 dir_path=$1
 find_opts=$2
 
 for file_path in $(find ${dir_path} ${find_opts} -type f)
 do
  mime_type=$(file --mime-type ${file_path})
  if [[ $mime_type =~ ^.*:[[:space:]]+image/(.*)$ ]]
  then
   img_paths[${#img_paths[*]}]=$file_path
  fi
 done
}

while getopts ":hd:r:t:s:" x
do
 case $x in
  h) usage 0 ;;
  t) transition_time=$OPTARG ;;
  s) static_time=$OPTARG ;;
  d) dirs[${#dirs[*]}]=$OPTARG ;;
  r) recursive_dirs[${#recursive_dirs[*]}]=$OPTARG ;;
 esac
done

if [[ -z $transition_time ]]; then usage; fi
if [[ -z $static_time ]]; then usage; fi
if [[ ${#dirs[*]} -eq 0 && ${#recursive_dirs[*]} -eq 0 ]]; then usage; fi

# array for our image paths
declare -a img_paths

# loop over directories to search non-recursively for images
for ((i=0; i<${#dirs[*]}; i++))
do
 set_img_paths "${dirs[$i]}" "-maxdepth 1"
done

# loop over directories to search recursively for images
for ((i=0; i<${#recursive_dirs[*]}; i++))
do
 set_img_paths "${recursive_dirs[$i]}" ""
done

# make sure we have some images
if [[ ${#img_paths[*]} -eq 0 ]]
then
 echo "Error: could not find any images"
 exit 2
fi

# randomize our array
random_order=$(seq ${#img_paths[*]} | shuf)
i=0
for r in $random_order
do
 randomized[$i]=${img_paths[$r-1]}
 i=$(( $i + 1 ))
done

# write our background xml file to stdout
echo ""
for ((i=0; i<${#randomized[*]}; i++))
do
 img_path=${randomized[$i]}
 echo -n "
 
  ${static_time}
  ${img_path}
 
"
 
 # transition to next image, or, if we are showing the last image, transition back to first image
 [[ $(( $i + 1 )) -lt ${#randomized[*]} ]] && next_img=${randomized[$i+1]} || next_img=${randomized[0]}
 echo -n "
 
  ${transition_time}
  ${img_path}
  ${next_img}
 
"
done
echo ""

Tuesday, October 18, 2011

oneiric ocelot 11.10 set background to xml file

gsettings set org.gnome.desktop.background picture-uri 'file:///path/to/file/background.xml' 
 
http://askubuntu.com/questions/67218/how-do-i-create-a-desktop-wallpaper-slideshow-in-oneiric


as best I can tell this property is stored in ~/.gconf/desktop/gnome/background/%gconf.xml

more to come on this in a bit