Skip to content

Commit

Permalink
cache config directory
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuanianji committed Mar 6, 2024
1 parent a466b0d commit aabdc36
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/edgedb-cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ export DEBIAN_FRONTEND=noninteractive

check_packages curl ca-certificates

create_cache_dir "/dc/edgedb-cli" "${USERNAME}"
create_symlink_dir "$_REMOTE_USER_HOME/.local/share/edgedb" "/dc/edgedb-cli" "${USERNAME}"
# cache data directory
create_cache_dir "/dc/edgedb-cli/data" "${USERNAME}"
create_symlink_dir "$_REMOTE_USER_HOME/.local/share/edgedb" "/dc/edgedb-cli/data" "${USERNAME}"

# cache config directory
create_cache_dir "/dc/edgedb-cli/config" "${USERNAME}"
create_symlink_dir "$_REMOTE_USER_HOME/.config/edgedb" "/dc/edgedb-cli/config" "${USERNAME}"

install_edgedb "${USERNAME}"

# Set Lifecycle scripts
Expand Down
16 changes: 11 additions & 5 deletions test/edgedb-cli/_default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,23 @@ source dev-container-features-test-lib
# check that the command is available
check "help" bash -c "edgedb --help | grep 'Usage'"

# check that `.config/gh` and `/dc/github-cli` exist under the user (should be node)
# check that data directories exist
check "~/.local/share/edgedb exists" bash -c "ls -la ~/.local/share | grep 'edgedb'"
check "/dc/edgedb-cli exists" bash -c "ls -la /dc | grep 'edgedb-cli'"
check "/dc/edgedb-cli/data exists" bash -c "ls -la /dc/edgedb-cli | grep 'data'"

# check that config directories exist
check "~/.config/edgedb exists" bash -c "ls -la ~/.config | grep 'edgedb'"
check "/dc/edgedb-cli exists" bash -c "ls -la /dc/edgedb-cli | grep 'config'"

# check that the folders are owned by the user
# https://askubuntu.com/a/175060
echo "Checking ownership of ~/.local/share/edgedb and /dc/edgedb-cli (ensure it is owned by $USER)"
ls -al ~/.local/share/
echo "Checking ownership of ~/.local/share/edgedb/data and /dc/edgedb-cli/data (ensure it is owned by $USER)"

check "~/.local/share/edgedb owned by user" bash -c "test \"$(stat -c "%U" ~/.local/share/edgedb)\" = $USER"
check "/dc/edgedb-cli owned by user" bash -c "test \"$(stat -c "%U" /dc/edgedb-cli)\" = $USER"
check "/dc/edgedb-cli/data owned by user" bash -c "test \"$(stat -c "%U" /dc/edgedb-cli/data)\" = $USER"

check "~/.config/edgedb owned by user" bash -c "test \"$(stat -c "%U" ~/.config/edgedb)\" = $USER"
check "/dc/edgedb-cli/config owned by user" bash -c "test \"$(stat -c "%U" /dc/edgedb-cli/config)\" = $USER"

# Report result
reportResults

0 comments on commit aabdc36

Please sign in to comment.