Supporting scripts
Table of Contents
- ConvertFromTextToHtmlCodeBox.sh
- CreateGuestDirectory.sh
- CreateMyTapInterface.sh
- GenerateHtmlFromAllSupportingScripst.sh
- simh.sh
- simh_3bsd_vax-11-780.sh
- simh_4-1bsd_vax-11-780.sh
- simh_4-2bsd_vax-11-780.sh
- simh_4-3bsd-reno_vax-11-780.sh
- simh_4-3bsd_vax-11-780.sh
- simh_4bsd_vax-11-780.sh
- simh_microvax-3900.sh
- simh_pdp-11.sh
- simh_ultrix-1.0_vax-11-780.sh
- simh_ultrix-1.1_vax-11-780.sh
- simh_ultrix-2.0_vax-11-780.sh
- simh_ultrix-3.0_microvax-3900.sh
- simh_ultrix-3.1_pdp-11.sh
- simh_ultrix-4.0_microvax-3900.sh
- simh_ultrix-4.0_vax-8600.sh
- simh_ultrix-4.2_microvax-3900.sh
- simh_ultrix-4.5_microvax-3900.sh
- simh_vax-11-750.sh
- simh_vax-11-780.sh
- simh_vax-8600.sh
- simh_vm2-2.0_vax-11-750.sh
Build environment
ConvertFromTextToHtmlCodeBox.sh
#!/bin/bash
#=====================================================================================
OutputDetailsHeader() {
if [[ $fDetail -eq 1 ]]; then
cat <<EOF
<details>
<summary style="background-color: #fdf6e3; border-color: red; border-radius: 0px; border-style: solid; line-height: 1; padding-bottom: 0em; padding-left: 0.3em; padding-top: 0em;">
Click here to see a run example<span class="icon">👇</span>
</summary>
EOF
fi
}
#=====================================================================================
OutputFileHeader() {
if [[ $fFileName -eq 1 ]]; then
declare sPath="$1"
declare sFilename="$2"
[[ -z "${sPath}" ]] && sPath="."
[[ -z "${sFilename}" ]] && sFilename=stdin
cat <<EOF
<div style="font-size: small; line-height: 1; text-align: right;">
<br />
<span style="font-family: courier; font-style: italic; line-height: 1; text-align: right;">
${sPath}
</span>
<br />
<span style="font-weight: bold;">
${sFilename}
</span>
<br />
<br />
</div>
EOF
fi
}
#=====================================================================================
OutputFileContents() {
cat <<EOF
<div style="background-color: #FDF6E3; border-style: solid; border-radius: 10px; border-color: blue; color: black; line-height: 1; padding-top: 0em; padding-left: 0.3em; padding-bottom: 0em; text-align: left;">
<span style="font-family: courier; font-size: small;">
EOF
#Result Description Entity Name Entity Number Try it
#non-breaking space  
#< less than < <
#> greater than > >
#& ampersand & &
#" double quotation mark " "
#' single quotation mark (apostrophe) ' '
#¢ cent ¢ ¢
#£ pound £ £
#¥ yen ¥ ¥
#€ euro € €
#© copyright © ©
#® registered trademark ® ®
sed 's/&/\&/g;
s/"/\"/g;
s/</\</g;
s/>/\>/g;
s/\\/\\/g ;
s/ /\ /g ;
1 s/^/<pre>/ ;
$ s/$/<\/pre>/' < <(
[[ -z "$1" ]] && cat
[[ ! -z "$1" ]] && cat "$1"
)
cat <<EOF
</span>
</div>
EOF
}
#=====================================================================================
OutputFileFooter() {
: nothing
}
#=====================================================================================
OutputDetailsFooter() {
[[ $fDetail -eq 1 ]] && echo "</details>"
}
#=====================================================================================
fDetail=1
fFileName=1
while [[ $# -gt 0 ]]; do
case "$1" in
--help | -h)
echo "
Syntax: $0 [options] input-file-name
Where options are:
-h | --help Display this help page
--no-detail Do not generate the <details> tag
--no-file-name Do not generate output for the file name
"
exit
;;
--h1) ;;
--h2) ;;
--id) shift ;;
--no-detail) fDetail=0 ;;
--no-file-name) fFileName=0 ;;
-*) echo "Option $1 is unknown"
exit ;;
-- | *) break ;;
esac
shift
done
if [[ -z "$1" ]]; then
sPath="."
sFilename="-"
else
sPath="$(dirname "$1")"
sFilename="$(basename "$1")"
fi
OutputDetailsHeader
OutputFileHeader "${sPath}" "${sFilename}"
OutputFileContents "${1}"
OutputFileFooter
OutputDetailsFooter
CreateGuestDirectory.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0) $*"
#echo "${SCRIPT_DIR}"
ShowHelp() {
echo "
$(basename "$1") [options] emulator-name guest-hardware guest-os
Where options are:
-- Stop processing options
-h | --help Show this help and exit
--virt-eng Name of the virtualization program
SimH
--guest-hw Guest simulator platform hardware
--guest-os Guest simulator OS
For SimH
--simh40 Use binaries from SimH 4.0 (Default)
--simh41 Use binaries from SimH 4.1
"
}
ExitWithMessage() {
echo "===> $*"
exit
}
ExitWithErrorMessage() {
ExitWithMessage "ERROR: $*"
}
sEmuName=
sGuestHw=
sGuestOs=
sSimHVersion=4.0
[[ "$(uname -s)" == CYGWIN* ]] && sRootEmulatorsDirectory=/cygdrive/f/
[[ "$(uname -s)" == Linux* ]] && sRootEmulatorsDirectory=/Volumes/vol000/
[[ "$(uname -s)" == Darwin* ]] && sRootEmulatorsDirectory=~/Desktop/
while [[ $# -gt 0 ]]; do
case "$1" in
--virt-eng) shift ; sEmuName=$1 ;;
--guest-hw) shift ; sGuestHw=$1 ;;
--guest-os) shift ; sGuestOs=$1 ;;
--simh40)
sSimHVersion=4.0
;;
--simh41)
sSimHVersion=4.1
;;
--help | -h)
ShowHelp
exit
;;
-- | *)
break
;;
esac
shift
done
[[ -z "${sRootEmulatorsDirectory}" ]] && ExitWithErrorMessage "sRootEmulatorsDirectory not defined"
[[ -z "${sEmuName}" ]] && ExitWithErrorMessage "No Virtualization Engine defined"
[[ -z "${sGuestHw}" ]] && ExitWithErrorMessage "No Guest Hardware Platform defined"
[[ -z "${sGuestOs}" ]] && ExitWithErrorMessage "No Guest OS defined"
mkdir -p "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/"
mkdir -p "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/mirror/"
mkdir -p "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/"
mkdir -p "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/${sGuestHw}_${sGuestOs}/"
mkdir -p "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/by-platform/"
mkdir -p "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/by-platform/${sGuestHw}/"
mkdir -p "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/by-os/"
mkdir -p "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/by-os/${sGuestOs}/"
( cd "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/by-platform/${sGuestHw}/"
[[ -h "${sGuestOs}" ]] && rm "${sGuestOs}"
ln -sf "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/${sGuestHw}_${sGuestOs}" "${sGuestOs}"
)
( cd "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/by-os/${sGuestOs}"
[[ -h "${sGuestHw}" ]] && rm "${sGuestHw}"
ln -sf "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/${sGuestHw}_${sGuestOs}" "${sGuestHw}"
)
case "${sEmuName}" in
SimH)
cd "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/mirror/"
unset sBinName
if [[ "$(uname -s)" == CYGWIN* ]]; then
EXE=.exe
else
EXE=
fi
if [[ ${sSimHVersion} == 4.0 ]]; then
[[ ! -d simh-4.0/BIN ]] && ExitWithErrorMessage "ERROR: Cannot find directory 'simh-4.0/BIN'. Did you download the package from https://github.com/simh/simh/suites/11977682803/artifacts/628547788?"
case "${sGuestHw}" in
pdp-11) sBinName=PDP11 ;;
microvax-3900) sBinName=MicroVAX3900 ;;
vax-11-750) sBinName=VAX750 ;;
vax-11-780) sBinName=VAX780 ;;
vax-8600) sBinName=VAX8600 ;;
*)
ExitWithErrorMessage "No process define yet for '${sGuestHw}' under '${sEmuName} 4.0'"
;;
esac
cd simh-4.0
chmod a+x BIN/*
elif [[ ${$sSimHVersion} == 4.1 ]]; then
if [[ -d simh-4.1 ]]; then
( cd simh-4.1 && git fetch --all -v )
else
git clone https://github.com/open-simh/simh.git simh-4.1
fi
echo "
===> Compiling and testing the simulator for '${sGuestHw}'
"
case "${sGuestHw}" in
pdp-11) sBinName=pdp11 ;;
microvax-3900) sBinName=microvax3900 ;;
vax-11-750) sBinName=vax750 ;;
vax-11-780) sBinName=vax780 ;;
vax-8600) sBinName=vax8600 ;;
*)
ExitWithErrorMessage "No process define yet for '${sGuestHw}' under '${sEmuName} 4.1'"
;;
esac
fi
[[ -z "${sBinName}" ]] && ExitWithErrorMessage "no binary program name defined for guest '${sGuestHw}'"
if [[ $sSimHVersion == 4.1 ]]; then
if [[ $(uname -s) == CYGWIN* ]]; then
[[ -d windows-build-windows-build ]] && mv windows-build-windows-build windows-build
if [[ -d windows-build && -f windows-build/winpcap/WpdPack/Include/pcap.h ]]; then
: # do nothing
else
if [[ ! -f windows-build.zip ]]; then
echo "===> Downloading pcap for Windows"
wget --quiet https://github.com/simh/windows-build/archive/windows-build.zip
fi
[[ -f windows-build.zip ]] && 7z x -y windows-build.zip
[[ -d windows-build-windows-build ]] && mv windows-build-windows-build windows-build
fi
[[ ! -f windows-build/winpcap/WpdPack/Include/pcap.h ]] && ExitWithErrorMessage "Cannot retrieve the pcap for the Windows build"
fi
cd simh-4.1 && make ${sBinName}
if [[ ! -x ./BIN/${sBinName} ]]; then
if [[ ${sBinName} == microvax3900 && -x ./BIN/vax ]]; then
echo "===> WARNING: executable not present. Creating new copy from base guest machine"
cp BIN/vax${EXE} BIN/${sBinName}${EXE}
else
ExitWithErrorMessage "Cannot find binary."
fi
fi
fi
[[ ! -x "./BIN/${sBinName}${EXE}" ]] && ExitWithErrorMessage "cannot find executable '$(pwd)/./BIN/${sBinName}${EXE}'"
./BIN/${sBinName}
cd "${sRootEmulatorsDirectory}/Emulators/${sEmuName}/guests/${sGuestHw}_${sGuestOs}/"
ln -sf ../../mirror/simh-${sSimHVersion}/BIN/${sBinName}${EXE} ${sBinName}-${sSimHVersion}
echo "===> Test run for the simulator link inside the guest base directory"
./${sBinName}-${sSimHVersion}
;;
*)
ExitWithErrorMessage "No process defined yet for '${sEmuName}'"
;;
esac
echo
echo "==> Contents of guest directory"
echo
ls
echo "
Execute the line below to change to your guest base directory
cd '$(pwd)'
"
CreateMyTapInterface.sh
#!/bin/bash
while [[ $# -gt 0 ]]; do
case "$1" in
--)
# stop processing parameters
break
;;
--help | -h)
echo "
$(basename "$0"): [options] virtualization-program [vendor] tap-id
Where virtualization-program can be:
simh SimH. You need to provide the vendor. Valid values are:
dec : PDP, VAX, MicroVAX
Where options are:
--help | -h This help screen
"
exit
;;
*)
break
;;
esac
shift
done
fErr=1
[[ "$1" == simh && $# -eq 3 ]] && fErr=0
[[ ${fErr} -eq 1 && $# -eq 2 ]] && fErr=0
if [[ ${fErr} -eq 1 ]]; then
echo "ERROR: Number of parameters ($#) for '$1' is wrong."
exit
fi
sVirt="$1"
sTapId="$2"
sVirtTapBase=""
sOUI=""
sNicId=""
case "${sVirt}" in
simh)
# 08:00:2B:5A:71:E1
sVirtTapBase="mytap_simh"
sOUI=""
case "$2" in
dec)
sOUI="08002B"
;;
*)
echo "ERROR: SimH: Invalid vendor '$2'"
exit
;;
esac
sNicId="000000${3}"
sNicId=${sNicId: -6}
;;
*)
echo "ERROR: Unknown virtualization program '${sVirt}'"
exit
;;
esac
sOUI=$(echo $sOUI|tr '[[:lower:]]' '[[:upper:]]')
sNicId=$(echo $sNicId|tr '[[:lower:]]' '[[:upper:]]')
case "$(uname -s)" in
CYGWIN*)
if [[ ! -x "/cygdrive/c/Program Files/OpenVPN/bin/openvpn" ]]; then
echo "ERROR: OpenVPN is not installed"
exit
fi
;;
esac
echo "Tap interface name is '${sVirtTapBase}_${sOUI}_${sNicId}'"
case "$(uname -s)" in
CYGWIN*)
wmic nic where '(NetConnectionId="'${sVirtTapBase}_${sOUI}_${sNicId}'")' get
exit
if [[ $(/cygdrive/c/Program\ Files/OpenVPN/bin/openvpn --show-adapters | grep -c "'${sVirtTapBase}_${sOUI}_${sNicId}'") -eq 0 ]]; then
cat <<EOF
Create a tap interface called '${sVirtTapBase}_${sOUI}_${sNicId}'
Open a cmd session as administrator and execute the following command:
"c:\Program Files\OpenVPN\bin\tapctl.exe" create --name "${sVirtTapBase}_${sOUI}_${sNicId}" --hwid root\tap0901
1) After adding to the bridge, the 'Network Connections' page is *not* automatically refreshed. You need to press F5 and confirm that the interface is type is "Network Bridge"
2) Please double check that the new tap interface is associated to 'TAP-Windows Adapter V9'
EOF
else
cat <<EOF
There is already a tap interface with this name.
EOF
fi
cat <<EOF
There is no CLI way to identify if this interface is already member of the network bridge. I will open the 'Control Panel\Network and Internet\Network Connections'. Please right clich the interface and then click "Add to bridge". Afther this is done, please press ENTER to continue.
EOF
cmd /c ncpa.cpl
read -p 'Press ENTER to continue: '
sSimHGuest=""
[[ -x microvax3900-4.1 ]] && sSimHGuest=microvax3900-4.1
/cygdrive/c/Program\ Files/OpenVPN/bin/openvpn --show-adapters | grep "'${sVirtTapBase}_${sOUI}_${sNicId}'"|awk '{print $2}'
printf 'show xq eth\nexit' > .tmp.$$.ini
./${sSimHGuest} .tmp.$$.ini
rm .tmp.$$.ini
;;
*)
echo "$(uname -s): I have no idea how to proceed...."
exit
;;
esac
case "${sVirt}" in
simh)
cat <<EOF
Add the following lines to your SimH .ini file
For a MicroVAX3900
; Network Interface
set xq enable
; Attention: If it fails with DELQA-T, try DELQA. The other option is DEQNA, which is the oldest board type
set xq type=delqa-t
set xq mac=${sOUI:0:2}:${sOUI:2:2}:${sOUI:4:2}:${sNicId:0:2}:${sNicId:2:2}:${sNicId:4:2}
attach xq ...
EOF
;;
*)
echo "${sVirt}: I have no idea what to suggest"
;;
esac
GenerateHtmlFromAllSupportingScripst.sh
#!/bin/bash
[[ -f /tmp/$$.tmp ]] && rm /tmp/$$.tmp
touch /tmp/$$.tmp
cat >> /tmp/$$.tmp <<EOF
<h1 style="text-align: left;">Supporting scripts</h1>
<h2 style="text-align: left;">Table of Contents</h2>
<ul>
EOF
c=1
for f in *.sh; do
echo "<li><a href=\"#chapter-id-${c}\">${f}</a></li>" >>/tmp/$$.tmp
((c++))
done
cat >>/tmp/$$.tmp <<EOF
</ul>
<h2 style="text-align: left;">Build environment</h2>
EOF
c=1
for f in *.sh; do
echo $f
cat >>/tmp/$$.tmp <<EOF
<h3 id="“chapter-id-${c}”" style="text-align: left;">${f}</h3>
EOF
./ConvertFromTextToHtmlCodeBox.sh --no-file-name --no-detail $f >> /tmp/$$.tmp
((c++))
done
case $(uname -s) in
CYGWIN*) cat /tmp/$$.tmp > /dev/clipboard ;;
#Darwin*)
#Linux*)
esac
rm /tmp/$$.tmp
simh.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0) $*"
"${SCRIPT_DIR}/CreateGuestDirectory.sh" --virt-eng SimH $*
simh_3bsd_vax-11-780.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-11-780.sh" 3bsd
simh_4-1bsd_vax-11-780.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-11-780.sh" 4-1bsd
simh_4-2bsd_vax-11-780.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-11-780.sh" 4-2bsd
simh_4-3bsd-reno_vax-11-780.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-11-780.sh" 4-3bsd-reno
simh_4-3bsd_vax-11-780.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-11-780.sh" 4-3bsd
simh_4bsd_vax-11-780.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-11-780.sh" 4bsd
simh_microvax-3900.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0) $*"
"${SCRIPT_DIR}/simh.sh" --guest-hw microvax-3900 $*
simh_pdp-11.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0) Guest OS: $1"
"${SCRIPT_DIR}/simh.sh" pdp-11 "$1"
simh_ultrix-1.0_vax-11-780.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-11-780.sh" --guest-os ultrix-1.0 $*
simh_ultrix-1.1_vax-11-780.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-11-780.sh" --guest-os ultrix-1.1 $*
simh_ultrix-2.0_vax-11-780.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-11-780.sh" --guest-os ultrix-2.0 $*
simh_ultrix-3.0_microvax-3900.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_microvax-3900.sh" ultrix-3.0
simh_ultrix-3.1_pdp-11.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_pdp-11.sh" ultrix-3.1
simh_ultrix-4.0_microvax-3900.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_microvax-3900.sh" --guest-os ultrix-4.0 $*
simh_ultrix-4.0_vax-8600.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-8600.sh" ultrix-4.0
simh_ultrix-4.2_microvax-3900.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_microvax-3900.sh" --guest-os ultrix-4.2 $*
simh_ultrix-4.5_microvax-3900.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_microvax-3900.sh" --guest-os ultrix-4.5 $*
simh_vax-11-750.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0) Guest OS: $1"
"${SCRIPT_DIR}/simh.sh" vax-11-750 "$1"
simh_vax-11-780.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0) $*"
"${SCRIPT_DIR}/simh.sh" --guest-hw vax-11-780 $*
simh_vax-8600.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0) Guest OS: $1"
"${SCRIPT_DIR}/simh.sh" vax-8600 "$1"
simh_vm2-2.0_vax-11-750.sh
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo "($0)"
"${SCRIPT_DIR}/simh_vax-11-750.sh" vms-2.0
Comments
Post a Comment