GNS3 Docker Images
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

139 lines
3.9 KiB

  1. # docker image for ostinato
  2. FROM debian:buster-slim
  3. COPY ostinato*.deb /tmp/
  4. RUN set -e -x \
  5. #
  6. # install ostinato
  7. #
  8. && export DEBIAN_FRONTEND=noninteractive \
  9. && apt-get update \
  10. && apt-get -y upgrade \
  11. && echo 'wireshark-common wireshark-common/install-setuid boolean false' | debconf-set-selections \
  12. && apt-get -y --no-install-recommends install \
  13. dumb-init /tmp/ostinato*.deb wireshark tshark \
  14. dillo ca-certificates lxterminal jwm menu mousepad wmctrl \
  15. net-tools iproute2 ifupdown inetutils-ping \
  16. telnet traceroute procps nano vim-tiny \
  17. && rm -rf /var/lib/apt/lists/* \
  18. && ln -s /usr/bin/dillo /usr/local/bin/firefox \
  19. #
  20. # customize jwm menu
  21. #
  22. && printf '\
  23. ?package(ostinato):\\\n\
  24. needs="x11"\\\n\
  25. section="Applications"\\\n\
  26. title="Ostinato"\\\n\
  27. command="ostinato > /var/log/ostinato.log 2>&1"\n' \
  28. > /etc/menu/ostinato \
  29. && printf '\
  30. ?package(wireshark):\\\n\
  31. needs="x11"\\\n\
  32. section="Applications"\\\n\
  33. title="Wireshark"\\\n\
  34. command="wireshark"\n' \
  35. > /etc/menu/wireshark \
  36. && printf '\
  37. ?package(mousepad):\\\n\
  38. needs="x11"\\\n\
  39. section="Applications/TextEditor"\\\n\
  40. title="Mousepad"\\\n\
  41. command="mousepad"\n' \
  42. > /etc/menu/mousepad \
  43. && echo "postrun=\"sed -i '/^ </ d' debian-menu\"" >> /etc/menu-methods/jwm \
  44. && sed -i 's/\(Desktops width\)="[0-9]*"/\1="2"/' /etc/jwm/system.jwmrc \
  45. && sed -i 's/xterm/x-terminal-emulator/g' /etc/jwm/system.jwmrc \
  46. && update-menus \
  47. #
  48. # start drone only when not already active
  49. #
  50. && mv /usr/bin/drone /usr/bin/drone.real \
  51. && printf '\
  52. \043!/bin/sh\n\
  53. \n\
  54. serve=y\n\
  55. port=7878\n\
  56. while getopts '\'':dhvp:'\'' opt; do\n\
  57. case "$opt" in\n\
  58. p) port="$OPTARG" ;;\n\
  59. h|v) serve= ;;\n\
  60. *) ;;\n\
  61. esac\n\
  62. done\n\
  63. \n\
  64. [ -n "$serve" ] && netstat -n -l -t | grep -q -F ":${port} " && exit 0\n\
  65. exec "${0#-}.real" "$@"\n' \
  66. > /usr/bin/drone && chmod +x /usr/bin/drone \
  67. #
  68. # configure ostinato drone
  69. #
  70. && mkdir -p /root/.config/Ostinato \
  71. && printf '\
  72. [General]\n\
  73. RateAccuracy=Low\n\
  74. [PortList]\n\
  75. Exclude=any,lo*\n' \
  76. > /root/.config/Ostinato/drone.ini \
  77. #
  78. # configure wireshark
  79. #
  80. && sed -i 's/^disable_lua *=.*/disable_lua = true/' /etc/wireshark/init.lua \
  81. #
  82. # set lxterminal defaults
  83. #
  84. && mkdir -p /root/.config/lxterminal \
  85. && printf '\
  86. [general]\n\
  87. scrollback=1000\n\
  88. fgcolor=#ffffff\n' \
  89. > /root/.config/lxterminal/lxterminal.conf \
  90. #
  91. # startup script
  92. #
  93. && printf '\
  94. \043!/bin/sh\n\
  95. [ $$ -eq 1 ] && exec dumb-init -- "$0" "$@"\n\
  96. \n\
  97. \043 disable ostinato update, makes no sense in this environment\n\
  98. grep -q -w -F update.ostinato.org /etc/hosts || \\\n\
  99. printf "\\n# disable ostinato update\\n127.0.0.127\\tupdate.ostinato.org\\n" >> /etc/hosts\n\
  100. \n\
  101. \043 on unconfigured GNS3 interfaces disable IPv6, set MTU to 9000\n\
  102. if [ -n "$GNS3_MAX_ETHERNET" ]; then\n\
  103. sed -n '\''s/^ *\\(eth[0-9]*\\):.*/\\1/p'\'' /proc/net/dev | sort > /tmp/netdev\n\
  104. sed -n '\''s/^iface *\\(eth[0-9]*\\).*/\\1/p'\'' /etc/network/interfaces | sort -u > /tmp/confdev\n\
  105. comm -13 /tmp/confdev /tmp/netdev | while read -r DEVICE; do\n\
  106. ip link set dev "$DEVICE" down\n\
  107. sysctl -q -w "net.ipv6.conf.${DEVICE}.disable_ipv6=1"\n\
  108. ip link set dev "$DEVICE" mtu 9000\n\
  109. ip link set dev "$DEVICE" up\n\
  110. done\n\
  111. rm /tmp/confdev /tmp/netdev\n\
  112. sleep 0.5\n\
  113. fi\n\
  114. \n\
  115. \043 workaround: sometimes the first start of an X application fails\n\
  116. lxterminal -e true 2> /dev/null\n\
  117. \n\
  118. cd\n\
  119. export SHELL=/bin/bash\n\
  120. \n\
  121. \043 start drone\n\
  122. drone < /dev/null > /var/log/ostinato-drone.log 2>&1 &\n\
  123. sleep 0.5\n\
  124. \n\
  125. \043 start ostinato, optionally a windows manager if none is active\n\
  126. if wmctrl -m > /dev/null 2>&1; then\n\
  127. ostinato > /var/log/ostinato.log 2>&1\n\
  128. else\n\
  129. ostinato > /var/log/ostinato.log 2>&1 &\n\
  130. jwm\n\
  131. fi\n' \
  132. > /etc/init.sh && chmod +x /etc/init.sh
  133. VOLUME [ "/root" ]
  134. CMD [ "/etc/init.sh" ]