Compare commits

..
2 Commits
Author SHA1 Message Date
fe5hua 99422bc415 dev container and git config 2026-10-09 06:19:05 +02:00
fe5hua 596b5873e6 made init hooks script idemptent 2026-09-15 06:24:20 +02:00
3 changed files with 94 additions and 23 deletions
+5 -1
View File
@@ -40,7 +40,11 @@ function dev
alsa-lib-devel \ alsa-lib-devel \
systemd-devel \ systemd-devel \
libxkbcommon \ libxkbcommon \
libxkbcommon-devel libxkbcommon-devel \
libappindicator-gtk3-devel \
librsvg2-devel \
libxdo-devel \
nodejs24
if distrobox list --no-color | string match -q "*| $name *" if distrobox list --no-color | string match -q "*| $name *"
distrobox enter $name distrobox enter $name
+5
View File
@@ -0,0 +1,5 @@
[user]
name = fe5hua
email = git@fe5hua.de
[init]
defaultBranch = main
+84 -22
View File
@@ -11,8 +11,9 @@ export DEV_USER="$(basename "$DEV_HOME")"
# Software directories # Software directories
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
mkdir -p /opt/rustup /opt/cargo /opt/aseprite mkdir -p /opt/rustup /opt/cargo /opt/aseprite /opt/dx /opt/npm-global
chown "$DEV_USER:$DEV_USER" /opt/rustup /opt/cargo /opt/aseprite chown -R "$DEV_USER:$DEV_USER" /opt/rustup /opt/cargo /opt/aseprite /opt/dx /opt/npm-global
# TODO basically all commamd from here on need to run as $DEV_USER, but scrpt runs as root
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Fish configuration # Fish configuration
@@ -34,19 +35,23 @@ EOF
export RUSTUP_HOME=/opt/rustup export RUSTUP_HOME=/opt/rustup
export CARGO_HOME=/opt/cargo export CARGO_HOME=/opt/cargo
echo "Installing rustup..." if [[ ! -x /opt/cargo/bin/rustup ]]; then
echo "Installing rustup..."
curl \ curl \
--proto '=https' \ --proto '=https' \
--tlsv1.2 \ --tlsv1.2 \
-sSf \ -sSf \
https://sh.rustup.rs \ https://sh.rustup.rs \
| sh -s -- -y --no-modify-path | sh -s -- -y --no-modify-path
else
echo "rustup is already installed."
fi
# Rust toolchain # Rust toolchain
echo "Installing stable Rust toolchain..." echo "Installing stable Rust toolchain..."
/opt/cargo/bin/rustup default stable /opt/cargo/bin/rustup default nightly
# Fish completions # Fish completions
echo "Installing rustup Fish completion..." echo "Installing rustup Fish completion..."
@@ -55,16 +60,47 @@ echo "Installing rustup Fish completion..."
| tee /etc/fish/completions/rustup.fish >/dev/null | tee /etc/fish/completions/rustup.fish >/dev/null
# Dioxus CLI
export DX_INSTALL=/opt/dx
if [[ ! -x /opt/cargo/bin/dx ]]; then
echo "Installing dioxus cli..."
# TODO needs to run as user, not root
curl -sSL https://dioxus.dev/install.sh | bash
else
echo "dioxus cli is already installed."
fi
# -----------------------------------------------------------------------------
# NodeJS and NPM
# -----------------------------------------------------------------------------
npm config set prefix '/opt/npm-global'
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Aseprite # Aseprite
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
echo "Building Aseprite..." if [[ -f /opt/aseprite/aseprite.desktop ]]; then
git clone --recursive https://github.com/aseprite/aseprite.git /opt/aseprite echo "Aseprite desktop entry already exists; skipping installation."
cd /opt/aseprite else
./build.sh --auto --norun if [[ ! -d /opt/aseprite ]]; then
echo "Cloning Aseprite..."
git clone --recursive https://github.com/aseprite/aseprite.git /opt/aseprite
else
echo "Aseprite source already exists."
fi
echo "Creating Aseprite desktop entry..." cd /opt/aseprite
cat > /opt/aseprite/aseprite.desktop <<'EOF' if [[ ! -x /opt/aseprite/build/bin/aseprite ]]; then
git submodule update --init --recursive
echo "Building Aseprite..."
./build.sh --auto --norun
else
echo "Aseprite is already built."
fi
echo "Creating Aseprite desktop entry..."
cat > /opt/aseprite/aseprite.desktop <<'EOF'
[Desktop Entry] [Desktop Entry]
Name=Aseprite Name=Aseprite
Comment=Animated sprite editor Comment=Animated sprite editor
@@ -74,9 +110,16 @@ Terminal=false
Type=Application Type=Application
Categories=Graphics;2DGraphics; Categories=Graphics;2DGraphics;
EOF EOF
fi
echo "Exporting Aseprite desktop entry..." if sudo -u "$DEV_USER" env HOME="$DEV_HOME" distrobox-export --list-apps 2>/dev/null |
sudo -u "$DEV_USER" env HOME="$DEV_HOME" distrobox-export --app /opt/aseprite/aseprite.desktop grep -Fq "aseprite"
then
echo "Aseprite desktop entry is already exported."
else
echo "Exporting Aseprite desktop entry..."
sudo -u "$DEV_USER" env HOME="$DEV_HOME" distrobox-export --app /opt/aseprite/aseprite.desktop
fi
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Export development tools to the host # Export development tools to the host
@@ -87,15 +130,31 @@ echo "Exporting development tools..."
export_bin() { export_bin() {
local binary="$1" local binary="$1"
if command -v "$binary" >/dev/null 2>&1; then if ! command -v "$binary" >/dev/null 2>&1; then
echo " warning: $binary not found"
elif sudo -u "$DEV_USER" env HOME="$DEV_HOME" \
distrobox-export \
--list-binaries \
--export-path "$DEV_HOME/.local/bin" 2>/dev/null |
awk -F'|' -v binary="$binary" '
{
name = $1
gsub(/^[[:space:]]+|[[:space:]]+$/, "", name)
if (name == binary) {
found = 1
}
}
END { exit !found }
'
then
echo " $binary is already exported."
else
echo " exporting $binary" echo " exporting $binary"
sudo -u "$DEV_USER" \ sudo -u "$DEV_USER" \
env HOME="$DEV_HOME" \ env HOME="$DEV_HOME" \
distrobox-export \ distrobox-export \
--bin "$(command -v "$binary")" \ --bin "$(command -v "$binary")" \
--export-path "$DEV_HOME/.local/bin" --export-path "$DEV_HOME/.local/bin"
else
echo " warning: $binary not found"
fi fi
} }
@@ -114,7 +173,10 @@ for binary in \
rust-gdb \ rust-gdb \
rust-gdbgui \ rust-gdbgui \
rust-lldb \ rust-lldb \
rustup rustup \
dx \
npm \
node
do do
export_bin "$binary" export_bin "$binary"
done done