Skip to content

Commit

Permalink
bootstrap: skip secrets mount on container
Browse files Browse the repository at this point in the history
  • Loading branch information
davidandreoletti committed Mar 11, 2024
1 parent e012a4d commit 20c72ba
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions install/bootstrap_fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ source "${BOOSTRAP_DIR}/common/shell/rust.sh"
source "${BOOSTRAP_DIR}/common/shell/tmux.sh"
source "${BOOSTRAP_DIR}/common/shell/sudo.sh"
source "${BOOSTRAP_DIR}/common/shell/user_password.sh"
source "${BOOSTRAP_DIR}/common/shell/container.sh"
source "${BOOSTRAP_DIR}/fedora/shell/sudoers.sh"
source "${BOOSTRAP_DIR}/fedora/shell/vnc.sh"
source "${BOOSTRAP_DIR}/fedora/shell/ssh.sh"
Expand Down
1 change: 1 addition & 0 deletions install/bootstrap_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ source "${BOOSTRAP_DIR}/common/shell/rust.sh"
source "${BOOSTRAP_DIR}/common/shell/tmux.sh"
source "${BOOSTRAP_DIR}/common/shell/sudo.sh"
source "${BOOSTRAP_DIR}/common/shell/user_password.sh"
source "${BOOSTRAP_DIR}/common/shell/container.sh"
source "${BOOSTRAP_DIR}/macosx/shell/sudoers.sh"
source "${BOOSTRAP_DIR}/macosx/shell/xcode.sh"
source "${BOOSTRAP_DIR}/macosx/shell/dmg.sh"
Expand Down
15 changes: 15 additions & 0 deletions install/common/shell/container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
container_is_running() {
if test -f /.dockerenv; then
# ubuntu 20.04+
return 0
elif test -e /bin/running-in_container; then
# Ubuntu 20.04+ support
if /bin/running-in_container; then
return 0
else
return 1
fi
else
return 1
fi
}
14 changes: 4 additions & 10 deletions install/fedora/shell/ramdisk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,17 @@ export CURRENT_MOUNT_DIR="none"
# storage mounted at /Volume/ramdiskname
ramdisk_create_and_mount_storage() {
local name="$1"
local mount_path="$HOME/$name"

uid=$(sudo id -u)
gid=$(sudo id -g)

if test $uid -eq 0; then
# Github CI test case only
local mount_path="/tmp/$name"
else
local mount_path="$HOME/$name"
fi

mkdir -p "$mount_path"
if sudo mount -t tmpfs -o size=128M,uid=$uid,gid=$gid,mode=700 "$name" "$mount_path"; then
if container_is_running; then
# CI case: No mount support in containers
:
else
dmesg
exit 1
sudo mount -t tmpfs -o size=128M,uid=$uid,gid=$gid,mode=700 "$name" "$mount_path"
fi

export CURRENT_MOUNT_DIR="$mount_path"
Expand Down

0 comments on commit 20c72ba

Please sign in to comment.