Build and play the classic text adventure game Zork directly in Azure Cloud Shell without needing root privileges or additional package installations.
Azure Cloud Shell provides a convenient browser-based shell environment, but it has limitations: you can't run as root and can't use apt-get to install packages like ncurses or termcap libraries. This script solves that problem by cloning the Zork source code and patching it to work with the libraries available in the Cloud Shell environment.
The build_zork_cloudshell.sh script automates the following:
- Clones the Zork repository from devshane/zork
- Patches the Makefile to:
- Remove dependencies on unavailable libraries (
-ltermcap,-ltinfo,-lncurses) - Add the
-DNO_TERMCAPcompiler flag - Fix the
TEXTFILEpath to use the localdtextc.datfile
- Remove dependencies on unavailable libraries (
- Patches
supp.cto provide fallback implementations of termcap functions using environment variables (LINESandCOLUMNS) - Patches
local.cto include<unistd.h>for thegetuid()function - Builds the game using the standard
makecommand
All patches are idempotent, so you can safely re-run the script without causing issues.
- Open Azure Cloud Shell in your browser
- Download and run the script:
curl -fsSL https://raw.githubusercontent.com/YOUR_USERNAME/zork-cloudshell/main/build_zork_cloudshell.sh -o build_zork_cloudshell.sh
chmod +x build_zork_cloudshell.sh
./build_zork_cloudshell.sh- Once built, play the game:
cd zork
./zork./build_zork_cloudshell.sh [OPTIONS]--rebuild- Clean and rebuild the existing Zork directory after re-applying patches--force-reclone- Delete the existing./zorkdirectory and clone a fresh copy--uninstall- Remove the./zorkdirectory and exit-h, --help- Display usage information
First-time installation:
./build_zork_cloudshell.shRebuild after modifications:
./build_zork_cloudshell.sh --rebuildStart fresh:
./build_zork_cloudshell.sh --force-recloneRemove installation:
./build_zork_cloudshell.sh --uninstallAfter building, navigate to the zork directory and run the game:
cd zork
./zorkThe game is the classic 1980s text adventure where you explore the dungeon. Type commands like go north, take lamp, open mailbox, etc.
- No termcap/ncurses libraries: Azure Cloud Shell doesn't include these terminal control libraries, and you can't install them without root access
- NO_TERMCAP flag: This tells the code to use fallback implementations instead of real termcap functions
- Terminal dimensions: The script provides simple stubs that read
LINESandCOLUMNSenvironment variables (which Cloud Shell sets automatically) - Missing headers: The
getuid()function requires<unistd.h>, which wasn't originally included inlocal.c
You can customize the installation location by setting the REPO_DIR environment variable:
REPO_DIR=/tmp/zork ./build_zork_cloudshell.sh- Azure Cloud Shell (Bash environment)
- Internet connection (for cloning the repository)
- Standard build tools (
git,make,gcc- all pre-installed in Cloud Shell)
Problem: Script fails to clone the repository
Solution: Check your internet connection and verify you can reach github.com
Problem: Build errors about missing functions
Solution: Run with --force-reclone to get a clean copy and re-apply patches
Problem: Game won't start or crashes
Solution: Make sure you're running it from the zork directory where dtextc.dat is located
This script is provided as-is for educational purposes. Zork itself is maintained in the devshane/zork repository - please refer to that repository for game licensing information.
Found a bug or have a suggestion? Feel free to open an issue or submit a pull request!
- Original Zork implementation: devshane/zork
- Inspired by the need to make classic games accessible in modern cloud environments