Skip to content

Commit

Permalink
Use enviornment bash. Use -n for snap check
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi311 committed Dec 5, 2022
1 parent 0e8d8a0 commit 0a9fc14
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions scripts/images.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env bash

function initImageVars {
if [ "$(uname -s)" == "Linux" ]; then
if [ "$ARCH" == "arm64" ]; then
EFI_1="$SNAP/usr/share/qemu/edk2-aarch64-code.fd"
EFI_2="$SNAP/usr/share/qemu/edk2-arm-vars.fd"
if [ "$SNAP" == "" ]; then
if [ -n "$SNAP" ]; then
QEMU=qemu-system-aarch64
else
QEMU="$SNAP/usr/bin/qemu-system-aarch64"
Expand All @@ -15,7 +17,7 @@ function initImageVars {
-device AC97 \
-serial mon:stdio"
else
if [ "$SNAP" == "" ]; then
if [ -n "$SNAP" ]; then
QEMU=qemu-system-x86_64
else
QEMU="$SNAP/usr/bin/qemu-system-x86_64"
Expand Down
4 changes: 3 additions & 1 deletion scripts/mounts.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

function initSettingsVars {
if [ "$(uname -s)" == "Darwin" ]; then
SETTINGS_FILE="$DATA_ROOT/sshd/settings.dmg"
Expand Down Expand Up @@ -57,7 +59,7 @@ function copySettingsIntoImage {

function startVirtiofsd {
# Return immediately in non-Snap environments
if [ "$SNAP" == "" ]; then
if [ -n "$SNAP" ]; then
return
fi
VIRTIOFS_SOCK="$SNAP_USER_DATA/$NAME-vhost-fs.sock"
Expand Down
2 changes: 1 addition & 1 deletion scripts/prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [ "$HOST_OS" == "Darwin" ]; then
brew install coreutils
elif [ "$HOST_OS" == "Linux" ]; then
# Only necessary in non-Snap environments
if [ "$SNAP" == "" ]; then
if [ -n "$SNAP" ]; then
sudo snap install --edge qemu-ut-pdk
sudo snap connect qemu-ut-pdk:kvm
# Heck, throw a group check in there too
Expand Down
6 changes: 4 additions & 2 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash

function warnMissingPlugs {
# Only run in Snap environments
if [ "$SNAP" == "" ]; then
if [ -n "$SNAP" ]; then
return
fi

Expand Down Expand Up @@ -149,7 +151,7 @@ function setup {

# Snap is done here, just needs ta check inside ya sshd settings
# (on other platforms)
if [ "$SNAP" == "" ]; then
if [ -n "$SNAP" ]; then
if [ -f "$DATA_ROOT/sshd/id_rsa" ]; then
rm "$DATA_ROOT/sshd/id_rsa"
fi
Expand Down
2 changes: 1 addition & 1 deletion ubuntu-touch-pdk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

set -e

Expand Down

0 comments on commit 0a9fc14

Please sign in to comment.