Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save sfxworks/98a2384258f97beae2e4b0a2a3d9b81c to your computer and use it in GitHub Desktop.

Select an option

Save sfxworks/98a2384258f97beae2e4b0a2a3d9b81c to your computer and use it in GitHub Desktop.

Revisions

  1. sfxworks revised this gist Jun 5, 2021. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions install package to qcow image.sh
    Original file line number Diff line number Diff line change
    @@ -4,20 +4,20 @@ sudo modprobe nbd

    sudo qemu-nbd --connect=/dev/nbd0 /full/path/to/qcow2/image/file

    sudo mkdir /mnt/ubuntu
    sudo mkdir /mnt/debian

    sudo mount /dev/nbd0p1 /mnt/ubuntu
    sudo mount /dev/nbd0p1 /mnt/debian

    sudo mount -t proc proc /mnt/ubuntu/proc/
    sudo mkdir /mnt/ubuntu/run/resolvconf
    sudo cp /etc/resolv.conf //mnt/ubuntu/run/resolvconf/
    sudo mount -t proc proc /mnt/debian/proc/
    sudo mkdir /mnt/debian/run/resolvconf
    sudo cp /etc/resolv.conf //mnt/debian/run/resolvconf/

    sudo chroot /mnt/ubuntu apt-get update
    sudo chroot /mnt/ubuntu apt-get install foo -y
    sudo chroot /mnt/debian apt-get update
    sudo chroot /mnt/debian apt-get install foo -y

    sudo umount /mnt/ubuntu/proc
    sudo umount /mnt/debian/proc

    sync

    sudo umount /mnt/ubuntu
    sudo umount /mnt/debian
    sudo qemu-nbd --disconnect /dev/nbd0
  2. @yuuichi-fujioka yuuichi-fujioka revised this gist Jun 4, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install package to qcow image.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@

    sudo apt-get install qemu-utils
    sudo modprove nbd
    sudo modprobe nbd

    sudo qemu-nbd --connect=/dev/nbd0 /full/path/to/qcow2/image/file

  3. @yuuichi-fujioka yuuichi-fujioka revised this gist Apr 17, 2014. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions install package to qcow image.sh
    Original file line number Diff line number Diff line change
    @@ -12,13 +12,12 @@ sudo mount -t proc proc /mnt/ubuntu/proc/
    sudo mkdir /mnt/ubuntu/run/resolvconf
    sudo cp /etc/resolv.conf //mnt/ubuntu/run/resolvconf/

    sudo chroot /mnt/ubuntu
    sudo chroot /mnt/ubuntu apt-get update
    sudo chroot /mnt/ubuntu apt-get install foo -y

    sudo apt-get update
    sudo apt-get install foo
    sudo umount /mnt/ubuntu/proc

    eixt
    sync

    sudo umount /mnt/ubuntu/proc
    sudo umount /mnt/ubuntu
    sudo qemu-nbd --disconnect /dev/nbd0
  4. @yuuichi-fujioka yuuichi-fujioka revised this gist Apr 17, 2014. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion install package to qcow image.sh
    Original file line number Diff line number Diff line change
    @@ -15,4 +15,10 @@ sudo cp /etc/resolv.conf //mnt/ubuntu/run/resolvconf/
    sudo chroot /mnt/ubuntu

    sudo apt-get update
    sudo apt-get install foo
    sudo apt-get install foo

    eixt

    sudo umount /mnt/ubuntu/proc
    sudo umount /mnt/ubuntu
    sudo qemu-nbd --disconnect /dev/nbd0
  5. @yuuichi-fujioka yuuichi-fujioka revised this gist Apr 17, 2014. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion install package to qcow image.sh
    Original file line number Diff line number Diff line change
    @@ -8,4 +8,11 @@ sudo mkdir /mnt/ubuntu

    sudo mount /dev/nbd0p1 /mnt/ubuntu

    sudo mount -t proc proc /mnt/ubuntu/proc/
    sudo mount -t proc proc /mnt/ubuntu/proc/
    sudo mkdir /mnt/ubuntu/run/resolvconf
    sudo cp /etc/resolv.conf //mnt/ubuntu/run/resolvconf/

    sudo chroot /mnt/ubuntu

    sudo apt-get update
    sudo apt-get install foo
  6. @yuuichi-fujioka yuuichi-fujioka created this gist Apr 17, 2014.
    11 changes: 11 additions & 0 deletions install package to qcow image.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@

    sudo apt-get install qemu-utils
    sudo modprove nbd

    sudo qemu-nbd --connect=/dev/nbd0 /full/path/to/qcow2/image/file

    sudo mkdir /mnt/ubuntu

    sudo mount /dev/nbd0p1 /mnt/ubuntu

    sudo mount -t proc proc /mnt/ubuntu/proc/