Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
421 changes: 189 additions & 232 deletions devsetup

Large diffs are not rendered by default.

Binary file removed devsetup_1.0.0_all.deb
Binary file not shown.
Binary file added devsetup_1.0.3_all.deb
Binary file not shown.
Binary file removed devsetup_1.1.0_all.deb
Binary file not shown.
9 changes: 6 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REPO_URL="https://github.com/Silver595/DevSetUp"
RAW_URL="https://raw.githubusercontent.com/Silver595/DevSetUp/main"
INSTALL_BIN="/usr/local/bin/devsetup"
INSTALL_SHARE="/usr/share/devsetup"
INSTALLER_VERSION="1.0.0"
INSTALLER_VERSION="1.0.3"

# ── Colors ────────────────────────────────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
Expand Down Expand Up @@ -76,8 +76,11 @@ fi
info "Installing devsetup to $INSTALL_BIN ..."
$SUDO_CMD mkdir -p "$INSTALL_SHARE/lib" "$INSTALL_SHARE/config"

# Rewrite DEVSETUP_DIR inside the script to point to installed location
sed "s|^DEVSETUP_DIR=.*|DEVSETUP_DIR=\"${INSTALL_SHARE}\"|" \
# Rewrite path vars so the installed binary finds its libraries
sed \
-e "s|^DEVSETUP_DIR=.*|DEVSETUP_DIR=\"${INSTALL_SHARE}\"|" \
-e "s|^LIB_DIR=.*|LIB_DIR=\"\${DEVSETUP_DIR}/lib\"|" \
-e "s|^CONF_DIR=.*|CONF_DIR=\"\${DEVSETUP_DIR}/config\"|" \
"$SRC/devsetup" > "$TMP_DIR/devsetup_patched"

$SUDO_CMD install -m 755 "$TMP_DIR/devsetup_patched" "$INSTALL_BIN"
Expand Down
61 changes: 41 additions & 20 deletions lib/tui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,55 +210,76 @@ tui_bash_select() {
echo "${result[*]}"
}

# ── Main TUI selector (backend dispatch) ──────────────────────────────────────
# ── Main TUI selector: writes result to stdout (for pipeline use) ─────────────
tui_select_tools() {
local -n _g="$1"

case "$TUI_BACKEND" in
whiptail|dialog)
# Build checklist args
local args=()
local sorted_cats=()
local args=() sorted_cats=()
IFS=$'\n' read -ra sorted_cats <<< "$(printf '%s\n' "${!_g[@]}" | sort)"
for cat in "${sorted_cats[@]}"; do
args+=("--- [${cat}] ---" "" "OFF")
for tool in ${_g[$cat]}; do
local state="OFF"
args+=("$tool" "" "$state")
done
for tool in ${_g[$cat]}; do args+=("$tool" "$cat" "OFF"); done
done
local selected
if [[ "$TUI_BACKEND" == "whiptail" ]]; then
selected=$(whiptail --title "devsetup — Tool Selector" \
--checklist "Space to toggle, Enter to confirm:" \
30 60 20 "${args[@]}" 3>&1 1>&2 2>&3)
30 65 20 "${args[@]}" 3>&1 1>&2 2>&3)
else
selected=$(dialog --title "devsetup — Tool Selector" \
--checklist "Space to toggle, Enter to confirm:" \
30 60 20 "${args[@]}" 2>&1 >/dev/tty)
30 65 20 "${args[@]}" 2>&1 >/dev/tty)
fi
[[ -z "$selected" ]] && return 1
echo "${selected//\"/}"
# strip category separators and quotes
echo "$selected" | tr -d '"' | tr ' ' '\n' \
| grep -v '^---' | grep -v '^\[' | tr '\n' ' '
;;
fzf)
local -a all_tools=()
for cat in "${!_g[@]}"; do
for tool in ${_g[$cat]}; do all_tools+=("[$cat] $tool"); done
local sorted_cats=()
IFS=$'\n' read -ra sorted_cats <<< "$(printf '%s\n' "${!_g[@]}" | sort)"
for cat in "${sorted_cats[@]}"; do
for tool in ${_g[$cat]}; do
all_tools+=("$(printf '%-12s %s' "[$cat]" "$tool")")
done
done
local chosen
chosen=$(printf '%s\n' "${all_tools[@]}" \
| fzf --multi --prompt="Select tools (Tab to multi-select): " \
--header="devsetup — Space or Tab to select" \
--height=80% --border=rounded --layout=reverse \
| awk '{print $2}') || return 1
echo "$chosen"
printf '%s\n' "${all_tools[@]}" \
| fzf --multi \
--prompt=" Search tools > " \
--header="devsetup | Tab/Space select · Enter confirm · Esc cancel" \
--height=90% --border=rounded --layout=reverse \
--color='header:italic,border:blue' \
| awk '{print $NF}' | tr '\n' ' ' || return 1
;;
bash)
tui_bash_select "$1"
;;
esac
}

# ── TUI selector that writes result to a file (avoids subshell redirect issues) ──
# This is what run_interactive uses so the TUI renders properly on screen.
tui_select_tools_to_file() {
local var_name="$1"
local out_file="$2"

case "$TUI_BACKEND" in
whiptail|dialog|fzf)
# These write to /dev/tty themselves — safe to capture stdout
local result; result="$(tui_select_tools "$var_name")" || return 1
echo "$result" > "$out_file"
;;
bash)
# Pure-bash TUI renders on >&2; result on stdout — safe to capture
local result; result="$(tui_bash_select "$var_name")" || return 1
echo "$result" > "$out_file"
;;
esac
}

# ── Simple read-from-tty ──────────────────────────────────────────────────────
tui_read() {
local prompt="$1" default="${2:-}"
Expand Down
20 changes: 11 additions & 9 deletions packaging/debian/control.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ Architecture: @@ARCH@@
Maintainer: @@MAINTAINER@@
Depends: bash (>= 4.0), curl, git
Recommends: whiptail | dialog, fzf
Replaces: devsetup (<< @@VERSION@@)
Conflicts: devsetup (<< 1.0.0)
Section: utils
Priority: optional
Homepage: https://github.com/Silver595/DevSetUp
Description: @@DESCRIPTION@@
devsetup is an interactive DevOps bootstrapper that installs and
configures common development tools (Docker, kubectl, Helm, Terraform,
AWS CLI, Node.js, Python, Git) on Debian/Ubuntu, Fedora, and Arch Linux.
devsetup is an interactive DevOps bootstrapper that sets up a fresh
Linux machine for development in one command. Pick tools in a TUI
and it handles OS detection, repo keys, and service setup for you.
.
Features:
- Interactive TUI tool selector
- Idempotent installs (skips already-installed tools)
- Git configuration wizard
- Shell alias injection
- Project folder scaffolding
- Dry-run mode
- Interactive TUI (whiptail / fzf / pure-bash arrow-key fallback)
- 36 tools across 9 categories (Docker, k8s, Terraform, PHP, MySQL...)
- Pre-flight doctor check (internet, sudo, disk space, apt lock)
- Idempotent installs, dry-run mode, step counter + summary box
- Git wizard, shell alias injection, project folder scaffolding
- Ctrl+C protection, lock file, network retry with backoff
16 changes: 14 additions & 2 deletions packaging/debian/postinst
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
#!/bin/bash
# postinst — runs after dpkg installs the package
# postinst — runs after dpkg installs or upgrades the package
set -e

case "$1" in
configure)
configure|upgrade)
# Ensure lib scripts are executable
chmod +x /usr/share/devsetup/lib/*.sh 2>/dev/null || true

# If a legacy /usr/local/bin/devsetup exists from a curl install,
# remove it so the .deb-managed /usr/bin/devsetup takes precedence
if [[ -f /usr/local/bin/devsetup && -f /usr/bin/devsetup ]]; then
rm -f /usr/local/bin/devsetup
echo " Removed legacy /usr/local/bin/devsetup — using package version."
fi

echo ""
echo " devsetup $(devsetup --version 2>/dev/null || echo '1.0.3') installed."
echo " Run: devsetup"
echo ""
;;
esac

Expand Down
13 changes: 11 additions & 2 deletions packaging/debian/prerm
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
#!/bin/bash
# prerm — runs before dpkg removes the package
# prerm — runs before dpkg removes or upgrades the package
set -e

case "$1" in
remove|purge)
# Remove injected aliases from any shell RCs if user runs purge
# Clean aliases from shell RC files on full removal
for rc in "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/fish/config.fish"; do
if [[ -f "$rc" ]] && grep -q '# >>> devsetup aliases >>>' "$rc" 2>/dev/null; then
sed -i '/# >>> devsetup aliases >>>/,/# <<< devsetup aliases <<</d' "$rc"
echo " Removed devsetup aliases from $rc"
fi
done
# Remove any legacy bin installed outside /usr/bin (e.g. /usr/local/bin from curl install)
rm -f /usr/local/bin/devsetup 2>/dev/null || true
# Remove any lock file
rm -f /tmp/devsetup.lock 2>/dev/null || true
;;
upgrade|deconfigure)
# On upgrade: remove old legacy binary if it exists alongside
rm -f /usr/local/bin/devsetup 2>/dev/null || true
rm -f /tmp/devsetup.lock 2>/dev/null || true
;;
esac

Expand Down