pokusio / passportjs-quickie

Just another of those works
0 stars 0 forks source link

pokusbox feature android #6

Open Jean-Baptiste-Lasselle opened 2 years ago

Jean-Baptiste-Lasselle commented 2 years ago

It is possible to run KVM QEMU and get ip address for the VM :

Jean-Baptiste-Lasselle commented 2 years ago
pkg install qemu-utils qemu-common qemu-system-x86_64-headless

mkdir -p alpine.iso/ && cd $_ wget http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_MAJOR_VERSION}.${ALPINE_MINOR_VERSION}/releases/x86_64/alpine-virt-${ALPINE_VERSION}-x86_64.iso

Create disk (note it won't actually take 4GB of space, more like 500MB)

qemu-img create -f qcow2 disque.dur.alpine.img 4G

lauunch the VM

qemu-system-x86_64 -machine q35 -m 1024 -smp cpus=2 -cpu qemu64 \ -drive if=pflash,format=raw,read-only,file=$PREFIX/share/qemu/edk2-x86_64-code.fd \ -netdev user,id=n1,hostfwd=tcp::2222-:22 -device virtio-net,netdev=n1 \ -cdrom alpine-virt-${ALPINE_VERSION}-x86_64.iso \ -nographic disque.dur.alpine.img


* The VM creation process will end with the login into the new VM. Login with user root (no password)

```bash

# Setup network (press Enter to use defaults):

setup-interfaces
# Available interfaces are: eth0.
# Enter '?' for help on bridges, bonding and vlans.
# Which one do you want to initialize? (or '?' or 'done') [eth0] 
# Ip address for eth0? (or 'dhcp', 'none', '?') [dhcp] 
# Do you want to do any manual network configuration? [no] 

# --> then activate netw interface
ifup eth0

# localhost:~# ifup eth0

# Et moi je vais  balancer de la VM avec 1 Gigas de RAM, non pas 4 Ggias
qemu-system-x86_64 -enable-kvm -m 1G -hda naugat-pre.img -vga std -netdev user,id=net0 -device virtio-net-pci,netdev=net0 

How the recipe shoudl work

# --> here there are a few instructions to follow, to update / activate new pkg repositories
apt update -y && apt upgrade -y && apt update -y
# --> see https://github.com/termux/termux-packages/wiki/Package-Management
termux-change-repo

# --> now install git, and openssh client and server packages
pkg install git openssh
# --> installing the 'openssh' package will cause the geenration of rsa and ecdsa  key pairs
# --> we will not touch all those key pairs, and generate a new one to 
#       add to SSH Keys to our Github Users : 
#       this will be done by installation process, using
#       github OAuith2, and therefore will be done by npm run preps:all 
#       well actually no, we could curl over https://, without SSH Key pair
#       the npm scripts and package.json, to run npm run:preps:all, and 
#       actually 

# + in termux, $HOME = /data/data/com.termux/files/home
mkdir -p ${HOME}/.pokus/.ssh/
chmod 700 -R ${HOME}/.pokus/.ssh/

ssh -keygen -t rsa -b 4096 -C "pokusbox@mobile.jbl.pokus.io" -P '' -f ${HOME}/.pokus/.ssh/pokusbox_git_key

ls -alh ${HOME}/.pokus/.ssh/

git clone git@github.com/:okusio/passportjs-quickie.git pokusbox/

cd pokusbox/

# will run :
npm run preps:android
npm run preps:android
Jean-Baptiste-Lasselle commented 2 years ago

https://gist.github.com/oofnikj/e79aef095cd08756f7f26ed244355d62

Jean-Baptiste-Lasselle commented 2 years ago