Forked from yuuichi-fujioka/install package to qcow image.sh
Last active
June 5, 2021 21:52
-
-
Save sfxworks/98a2384258f97beae2e4b0a2a3d9b81c to your computer and use it in GitHub Desktop.
install apt-get package to qcow2 image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install qemu-utils | |
sudo modprobe nbd | |
sudo qemu-nbd --connect=/dev/nbd0 /full/path/to/qcow2/image/file | |
sudo mkdir /mnt/debian | |
sudo mount /dev/nbd0p1 /mnt/debian | |
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/debian apt-get update | |
sudo chroot /mnt/debian apt-get install foo -y | |
sudo umount /mnt/debian/proc | |
sync | |
sudo umount /mnt/debian | |
sudo qemu-nbd --disconnect /dev/nbd0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment