-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
74 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash -ex | ||
|
||
service ssh start | ||
|
||
bash |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,13 @@ | ||
#!/bin/bash -x | ||
docker run --name qtxrpi -p 127.0.0.1:8022:8022/tcp ghcr.io/hgrf/qemu-rpi4:latest /run_qemu_nographic.sh & | ||
QEMU_PID=$! | ||
#!/bin/bash -ex | ||
|
||
OPTS="-o StrictHostKeyChecking=no -p8022" | ||
TARGET="[email protected]" | ||
CONN="$OPTS $TARGET" | ||
PASS="qtxrpi" | ||
sshpass -p $PASS ssh $CONN true | ||
while test $? -gt 0; do | ||
sleep 5 | ||
echo "Trying again..." | ||
sshpass -p $PASS ssh $CONN true | ||
done | ||
cp /mnt/entrypoint.sh /usr/bin/ | ||
|
||
# install Qt5.15 in qemu-rpi virtual machine# | ||
sshpass -p $PASS ssh $CONN \ | ||
"sudo apt update && \ | ||
sudo apt install -y xorg libqt5gui5 libqt5bluetooth5 && \ | ||
sudo mkdir -p /usr/local && \ | ||
echo /usr/local/qt5.15/lib | sudo tee /etc/ld.so.conf.d/qt5.15.conf && \ | ||
sudo ldconfig" | ||
sshpass -p $PASS rsync -avz -e "ssh $OPTS" --rsync-path="sudo rsync" $1 $TARGET:/usr/local/ | ||
apt update | ||
apt install -y ssh xorg libqt5gui5 libqt5bluetooth5 libgles2-mesa | ||
rm -rf /var/lib/apt/lists/* | ||
mkdir -p /usr/local | ||
echo /usr/local/qt5.15/lib | tee /etc/ld.so.conf.d/qt5.15.conf | ||
ldconfig | ||
ssh-keygen -A -v | ||
|
||
# set up autologin | ||
sshpass -p $PASS ssh $CONN \ | ||
"sudo systemctl --quiet set-default multi-user.target && \ | ||
sudo bash -c 'cat > /etc/systemd/system/[email protected]/autologin.conf << EOF | ||
[Service] | ||
ExecStart= | ||
ExecStart=-/sbin/agetty --autologin qtxrpi --noclear %I \$TERM | ||
EOF | ||
'" | ||
|
||
# set up startx on login | ||
sshpass -p $PASS ssh $CONN \ | ||
"bash -c 'cat > /home/qtxrpi/.profile << EOF | ||
if ! DISPLAY=:0 timeout 1s xset q &>/dev/null; then | ||
startx | ||
else | ||
echo \"X is already running :-)\" | ||
fi | ||
EOF | ||
'" | ||
|
||
sshpass -p $PASS ssh $CONN \ | ||
"sudo bash -c 'cat > /etc/X11/xorg.conf.d/10-monitor.conf << EOF | ||
Section \"Monitor\" | ||
Identifier \"Virtual-1\" | ||
Option \"PreferredMode\" \"1920x1080\" | ||
EndSection | ||
EOF | ||
'" | ||
|
||
if [ $? -gt 0 ]; then | ||
echo "Failed to install dependencies" | ||
sshpass -p $PASS ssh $CONN "sudo shutdown now" | ||
wait $QEMU_PID | ||
exit 1 | ||
fi | ||
|
||
# shut down the virtual machine and wait for it to finish | ||
sshpass -p $PASS ssh $CONN "sudo shutdown now" | ||
wait $QEMU_PID | ||
|
||
docker stop qtxrpi | ||
docker commit qtxrpi ghcr.io/hgrf/qtxrpi:latest | ||
echo "pi:qtxrpi" | chpasswd |