Jump to content

User:Z3ntu/Tips-and-tricks

From postmarketOS Wiki
Revision as of 15:33, 29 September 2024 by Z3ntu (talk | contribs) (Create page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Install apk in debug-shell

To install apk.static in initramfs (debug-shell), after running this you can just run e.g. apk add i2ctools and use that.

# See "USB Internet" page
route add default gw 172.16.42.2
echo nameserver 1.1.1.1 > /etc/resolv.conf

(
set -e
arch="$(uname -m)"
if [ "$arch" = "aarch64" ]; then
    file="$(wget -q -O- http://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/ | sed -n '/apk-tools-static/s/.*>\(apk-tools-static-.*\.apk\)<.*/\1/p')"
    wget http://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/"$file"
elif [ "$arch" = "armv7l" ]; then
    file="$(wget -q -O- http://dl-cdn.alpinelinux.org/alpine/edge/main/armv7/ | sed -n '/apk-tools-static/s/.*>\(apk-tools-static-.*\.apk\)<.*/\1/p')"
    wget http://dl-cdn.alpinelinux.org/alpine/edge/main/armv7/"$file"
fi
#[ "$(uname -m)" == "aarch64" ] && wget http://dl-cdn.alpinelinux.org/alpine/edge/main/aarch64/apk-tools-static-2.14.0-r5.apk
#[ "$(uname -m)" == "armv7l" ] && wget http://dl-cdn.alpinelinux.org/alpine/edge/main/armv7/apk-tools-static-2.14.0-r5.apk
tar -xvf apk-tools-static-*.apk
ln -s /sbin/apk.static /sbin/apk
mkdir -p /etc/apk/
echo -e "http://mirror.postmarketos.org/postmarketos/master\nhttp://dl-cdn.alpinelinux.org/alpine/edge/main\nhttp://dl-cdn.alpinelinux.org/alpine/edge/community\nhttp://dl-cdn.alpinelinux.org/alpine/edge/testing" > /etc/apk/repositories
apk add --allow-untrusted --initdb alpine-keys postmarketos-keys
)