Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: liucougar/quickstart
base: 6c70854ead
head fork: liucougar/quickstart
compare: 4db4ba0d97
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Sep 17, 2011
@liucougar remove default argumment -m to chpasswd in set_password
in recent chpasswd -m argument is removed (need to use usermod to set pre-hashed password)
@liucougar added a third argument to mount_qemu_img to pass in extra arguments t…
…o qemu-nbd

more checking when cleaning up qemu mounted image: if the nbd is still mounted, don't try to disconnect it
Showing with 7 additions and 3 deletions.
  1. +2 −1  modules/
  2. +5 −2 modules/
3  modules/
@@ -188,13 +188,14 @@ install_portage_tree() {
set_password() {
local username=$1
local pswd=$2
- local opts=${3:-"-m"}
+ local opts=$3
spawn_chroot "echo '${username}:${pswd}' | chpasswd ${opts}" || die "could not set $username password"
set_root_password() {
if [ -n "${root_password_hash}" ]; then
+ #TODO: use usermod to set pre-hashed password
set_password root "${root_password_hash}" "-e"
elif [ -n "${root_password}" ]; then
set_password root "${root_password}"
7 modules/
@@ -14,6 +14,7 @@ nbd_device=
local filename=$1
local device=${2:-"/dev/nbd0"}
+ local opts=$3
if [ ! -b /dev/nbd0 ]; then
#max_part=8 to enable partitions
@@ -33,7 +34,7 @@ mount_qemu_img(){
ps aux | grep qemu-nbd | grep ${device}
die "${device} is already connected."
- if ! qemu-nbd -c "${device}" "${filename}"; then
+ if ! qemu-nbd ${opts} -c "${device}" "${filename}"; then
die "qmeu-nbd failed to load ${filename} and connect it to ${device}"
@@ -52,7 +53,9 @@ mount_qemu_img(){
cleanup_nbd() {
if [ ! -z "${nbd_device}" ]; then
debug cleanup_nbd "disconnect nbd device ${nbd_device}"
- if ! spawn "qemu-nbd -d \"${nbd_device}\""; then
+ if mount | grep ${nbd_device} > /dev/null 2>&1; then
+ warn "${nbd_device} is still mounted! not disconnect nbd device."
+ elif ! spawn "qemu-nbd -d \"${nbd_device}\""; then
warn "cleanup_nbd: Failed to disconnect nbd device ${nbd_device}"

No commit comments for this range

Something went wrong with that request. Please try again.