Skip to content

Commit fba3ec3

Browse files
committed
move setup command to bash file
Signed-off-by: Ubuntu <newton-x1@svc-ado-007.ouans5uoojaeda1bo2vkwkz51c.bx.internal.cloudapp.net> Signed-off-by: Manoj Kumar Yadav <[email protected]>
1 parent 5d4f9bd commit fba3ec3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
// Use 'postCreateCommand' to run commands after the container is created
2121
"postCreateCommand": "bash .devcontainer/setup.sh",
2222

23-
// Runs each time the container starts/restarts
24-
// Only run these commands if /dev/kvm exists
25-
"postStartCommand": "if [ -e /dev/kvm ]; then sudo chown root:kvm /dev/kvm && sudo chmod 660 /dev/kvm && sudo usermod -aG kvm vscode; else echo 'KVM device not found, skipping...'; fi",
23+
// Runs each time the container starts/restarts and set kvm permissions
24+
"postStartCommand": "bash .devcontainer/setup.sh",
25+
2626
"customizations": {
2727
"vscode": {
2828
"extensions": [

.devcontainer/setup.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@
33
# Change device ownership
44
sudo chown -R $REMOTE_USER:$REMOTE_GROUP $DEVICE
55

6+
# Check for the KVM device and adjust permissions.
7+
if [ -e /dev/kvm ]; then
8+
sudo chown root:kvm /dev/kvm
9+
sudo chmod 660 /dev/kvm
10+
sudo usermod -aG kvm vscode
11+
else
12+
echo 'KVM device not found, skipping...'
13+
fi

0 commit comments

Comments
 (0)