Unverified Commit 608563d0 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Add devcontainer (#939)

parent 5fcd22b0
Loading
Loading
Loading
Loading

.devcontainer.json

0 → 100644
+6 −0
Original line number Diff line number Diff line
{
  "name": "dsm",
  "service": "dsm",
  "forwardPorts": ["5000"],
  "dockerComposeFile": "compose.yml"
}
+12 −3
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ getHostPorts() {

configureUser() {

  NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.1,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"
  NET_OPTS="-netdev user,id=hostnet0,host=${VM_NET_IP%.*}.2,net=${VM_NET_IP%.*}.0/24,dhcpstart=$VM_NET_IP,hostname=$VM_NET_HOST"

  local forward
  forward=$(getUserPorts "$USER_PORTS")
@@ -365,7 +365,13 @@ getInfo() {

  if [ ! -d "/sys/class/net/$VM_NET_DEV" ]; then
    error "Network interface '$VM_NET_DEV' does not exist inside the container!"
    error "$ADD_ERR -e \"VM_NET_DEV=NAME\" to specify another interface name." && exit 27
    error "$ADD_ERR -e \"VM_NET_DEV=NAME\" to specify another interface name." && exit 26
  fi

  BASE_IP="${VM_NET_IP%.*}."

  if [ "${VM_NET_IP/$BASE_IP/}" -lt "3" ]; then
    error "Invalid VM_NET_IP, must end in a higher number than .3" && exit 27
  fi
  
  if [ -z "$MTU" ]; then
@@ -436,7 +442,10 @@ if [[ "$DEBUG" == [Yy1]* ]]; then
  line="Host: $HOST  IP: $IP  Gateway: $GATEWAY  Interface: $VM_NET_DEV  MAC: $VM_NET_MAC  MTU: $mtu"
  [[ "$MTU" != "0" ]] && [[ "$MTU" != "$mtu" ]] && line+=" ($MTU)"
  info "$line"
  [ -f /etc/resolv.conf ] && grep '^nameserver*' /etc/resolv.conf
  if [ -f /etc/resolv.conf ]; then
    nameservers=$(grep '^nameserver*' /etc/resolv.conf | head -c -1 | sed 's/nameserver //g;' | sed -z 's/\n/, /g')
    [ -n "$nameservers" ] && info "Nameservers: $nameservers"
  fi
  echo
fi