28 lines
1.6 KiB
Bash
28 lines
1.6 KiB
Bash
|
|
#!/bin/sh
|
||
|
|
# One-time (per boot) install of git and fzf -- needs network.
|
||
|
|
# thefuck is deliberately NOT auto-installed: it needs python3/py3-pip
|
||
|
|
# plus a C build toolchain for musl (no prebuilt wheels for some of its
|
||
|
|
# deps), which this minimal image does not carry, and which would be
|
||
|
|
# painfully slow to compile under emulation. Install it by hand if you
|
||
|
|
# want it: apk add python3 py3-pip gcc musl-dev python3-dev &&
|
||
|
|
# pip3 install --break-system-packages thefuck
|
||
|
|
if [ ! -f /var/adaptive-setup-done ]; then
|
||
|
|
echo 'AdaptiveOS: bringing up network and installing git + fzf...'
|
||
|
|
ip link set eth0 up 2>/dev/null
|
||
|
|
ip addr add 10.0.2.15/24 dev eth0 2>/dev/null
|
||
|
|
ip route add default via 10.0.2.2 2>/dev/null
|
||
|
|
echo 'nameserver 10.0.2.3' > /etc/resolv.conf
|
||
|
|
if timeout 5 ping -c1 -W3 1.1.1.1 >/dev/null 2>&1; then
|
||
|
|
grep -q 'dl-cdn.alpinelinux.org/alpine/v3.19/main' /etc/apk/repositories || echo 'http://dl-cdn.alpinelinux.org/alpine/v3.19/main' >> /etc/apk/repositories
|
||
|
|
grep -q 'dl-cdn.alpinelinux.org/alpine/v3.19/community' /etc/apk/repositories || echo 'http://dl-cdn.alpinelinux.org/alpine/v3.19/community' >> /etc/apk/repositories
|
||
|
|
: > /tmp/adaptive-setup.log
|
||
|
|
timeout 60 apk update -q >>/tmp/adaptive-setup.log 2>&1
|
||
|
|
timeout 90 apk add -q git fzf >>/tmp/adaptive-setup.log 2>&1
|
||
|
|
touch /var/adaptive-setup-done
|
||
|
|
echo 'AdaptiveOS: git + fzf installed. (log: /tmp/adaptive-setup.log)'
|
||
|
|
else
|
||
|
|
echo 'AdaptiveOS: no network reachable -- skipping git/fzf install'
|
||
|
|
touch /var/adaptive-setup-done
|
||
|
|
fi
|
||
|
|
fi
|