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.
 
 
 
 
 

136 lines
3.8 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. port=7878\n\
  55. while getopts '\'':dhvp:'\'' opt; do\n\
  56. case "$opt" in\n\
  57. p) port="$OPTARG" ;;\n\
  58. d) ;;\n\
  59. *) exec "${0#-}.real" "$@" ;;\n\
  60. esac\n\
  61. done\n\
  62. \n\
  63. exec flock -n -E 0 -F "/var/lock/drone.$port" "${0#-}.real" "$@"\n' \
  64. > /usr/bin/drone && chmod +x /usr/bin/drone \
  65. #
  66. # configure ostinato drone
  67. #
  68. && mkdir -p /root/.config/Ostinato \
  69. && printf '\
  70. [General]\n\
  71. RateAccuracy=Low\n\
  72. [PortList]\n\
  73. Exclude=any,lo*\n' \
  74. > /root/.config/Ostinato/drone.ini \
  75. #
  76. # configure wireshark
  77. #
  78. && sed -i 's/^disable_lua *=.*/disable_lua = true/' /etc/wireshark/init.lua \
  79. #
  80. # set lxterminal defaults
  81. #
  82. && mkdir -p /root/.config/lxterminal \
  83. && printf '\
  84. [general]\n\
  85. scrollback=1000\n\
  86. fgcolor=#ffffff\n' \
  87. > /root/.config/lxterminal/lxterminal.conf \
  88. #
  89. # startup script
  90. #
  91. && printf '\
  92. \043!/bin/sh\n\
  93. [ $$ -eq 1 ] && exec dumb-init -- "$0" "$@"\n\
  94. \n\
  95. \043 disable ostinato update, makes no sense in this environment\n\
  96. grep -q -w -F update.ostinato.org /etc/hosts || \\\n\
  97. printf "\\n# disable ostinato update\\n127.0.0.127\\tupdate.ostinato.org\\n" >> /etc/hosts\n\
  98. \n\
  99. \043 on unconfigured GNS3 interfaces disable IPv6, set MTU to 9000\n\
  100. if [ -n "$GNS3_MAX_ETHERNET" ]; then\n\
  101. sed -n '\''s/^ *\\(eth[0-9]*\\):.*/\\1/p'\'' /proc/net/dev | sort > /tmp/netdev\n\
  102. sed -n '\''s/^iface *\\(eth[0-9]*\\).*/\\1/p'\'' /etc/network/interfaces | sort -u > /tmp/confdev\n\
  103. comm -13 /tmp/confdev /tmp/netdev | while read -r DEVICE; do\n\
  104. ip link set dev "$DEVICE" down\n\
  105. sysctl -q -w "net.ipv6.conf.${DEVICE}.disable_ipv6=1"\n\
  106. ip link set dev "$DEVICE" mtu 9000\n\
  107. ip link set dev "$DEVICE" up\n\
  108. done\n\
  109. rm /tmp/confdev /tmp/netdev\n\
  110. sleep 0.5\n\
  111. fi\n\
  112. \n\
  113. \043 workaround: sometimes the first start of an X application fails\n\
  114. lxterminal -e true 2> /dev/null\n\
  115. \n\
  116. cd\n\
  117. export SHELL=/bin/bash\n\
  118. \n\
  119. \043 start drone\n\
  120. drone < /dev/null > /var/log/ostinato-drone.log 2>&1 &\n\
  121. \n\
  122. \043 start ostinato, optionally a windows manager if none is active\n\
  123. if wmctrl -m > /dev/null 2>&1; then\n\
  124. ostinato > /var/log/ostinato.log 2>&1\n\
  125. else\n\
  126. ostinato > /var/log/ostinato.log 2>&1 &\n\
  127. jwm\n\
  128. fi\n' \
  129. > /etc/init.sh && chmod +x /etc/init.sh
  130. VOLUME [ "/root" ]
  131. CMD [ "/etc/init.sh" ]