|
17 | 17 | fi |
18 | 18 |
|
19 | 19 | log "In OnCreate script" |
20 | | - |
21 | | -FEATURE_DIR="/usr/local/share/stuartleeks-devcontainer-features/azure-cli-persistence" |
22 | | -LOG_FILE="$FEATURE_DIR/log.txt" |
23 | | - |
24 | | -log() { |
25 | | - echo "$1" |
26 | | - echo "$1" >> "$LOG_FILE" |
27 | | -} |
28 | | - |
29 | | -if command -v sudo > /dev/null; then |
30 | | - sudo chown -R "$(id -u):$(id -g)" "$LOG_FILE" |
31 | | -else |
32 | | - chown -R "$(id -u):$(id -g)" "$LOG_FILE" |
| 20 | +# check if marker file exists to avoid re-running oncreate script actions |
| 21 | +if [ -f "$HOME/.stuartleeks/azure-cli-persistence-oncreate" ]; then |
| 22 | + log "Feature 'azure-cli-persistence' oncreate actions already run, skipping" |
| 23 | + exit 0 |
33 | 24 | fi |
34 | 25 |
|
35 | | -log "In OnCreate script" |
36 | 26 |
|
37 | 27 | fix_permissions() { |
38 | 28 | local dir |
|
92 | 82 | # If we haven't got an old .azure folder with a cliextensions folder in it, check if the new cliextensions folder is a symlink to the old one |
93 | 83 | # And if so, remove the symlink |
94 | 84 | # This can happen if the user has installed the azure-cli feature and specified extensions to install |
95 | | - # and then later removed the extensions. |
| 85 | + # and then later removed the extensions.cd |
96 | 86 | if [ -L "$new_cliextensions_folder" ]; then |
97 | 87 | symlink_target=$(readlink "$new_cliextensions_folder") |
98 | 88 | if [ "$symlink_target" = "$old_cliextensions_folder" ]; then |
|
101 | 91 | fi |
102 | 92 | fi |
103 | 93 | fi |
| 94 | + |
| 95 | + |
| 96 | +log "Adding marker file to indicate oncreate actions have been run" |
| 97 | +mkdir -p "$HOME/.stuartleeks" |
| 98 | +if command -v sudo > /dev/null; then |
| 99 | + sudo touch "$HOME/.stuartleeks/azure-cli-persistence-oncreate" |
| 100 | +else |
| 101 | + touch "$HOME/.stuartleeks/azure-cli-persistence-oncreate" |
| 102 | +fi |
0 commit comments