Created
January 5, 2014 14:01
-
-
Save commonquail/8268555 to your computer and use it in GitHub Desktop.
Setup Debian D development evironment.
Installs Sayol's D APT repository (http://d-apt.sourceforge.net/) and prompts to install compilers and DUB.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Setup a D development environment on a Debian system. | |
# Installs the D APT repository and prompts to install compilers DMD, LDC, and | |
# GDC, and package manager DUB. | |
# Licence: MIT/Expat. | |
daptsrc=http://netcologne.dl.sourceforge.net/project/d-apt/files/d-apt.list | |
daptlist=/etc/apt/sources.list.d/d-apt.list | |
wget ${daptsrc} -O ${daptlist} | |
[[ -f ${daptlist} ]] || { | |
echo "fatal: couldn't get ${daptlist} from ${daptsrc}" | |
exit 1 | |
} | |
apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring && \ | |
apt-get update -o Dir::Etc::SourceList="${daptlist}" \ | |
-o Dir::Etc::SourceParts="-" -o APT::Get::List-Cleanup="0" | |
echo | |
pkgs=() | |
# Prompt to install a package. | |
# arg1: human readable name. | |
# arg2: APT package name. | |
# arg3: Y/N. Optional. Default choice. | |
prompt_install() | |
{ | |
local name=$1 | |
local package=$2 | |
local default=${3:-"N"} | |
local prompt="Install ${name} [" | |
if [[ $default == "Y" ]]; then | |
prompt+="Y/n] (yes)? " | |
else | |
prompt+="y/N] (no)? " | |
fi | |
read -p "$prompt" -r | |
[[ -z $REPLY ]] && REPLY=$default | |
[[ $REPLY =~ ^[Yy](es)?$ ]] && pkgs+=("$package") | |
} | |
prompt_install "DMD" "dmd-bin" "Y" | |
prompt_install "LDC" "ldc" | |
prompt_install "GDC" "gdc" | |
prompt_install "DUB" "dub" "Y" | |
[[ ! -z $pkgs ]] && apt-get -y install ${pkgs[@]} | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment