Alpine packer updates

- Ostinato .apk building script generalized to use it for any package
- Reset terminal mode using /etc/motd
This commit is contained in:
Bernhard Ehlers 2021-05-25 14:47:24 +02:00
parent 0991569c86
commit 69aec6bfe5
5 changed files with 43 additions and 29 deletions

View File

@ -0,0 +1,34 @@
#!/bin/sh
package=$1
version=$2
if [ -z "$package" ]; then
echo "Usage: docker-apk-build <package> [<alpine version>]" >&2
exit 1
fi
[ -z "$version" ] && version="latest"
mkdir -p "$package"
docker run --rm -i -v "$PWD/$package:/package" -e "package=$package" alpine:$version << 'EOF'
apk add alpine-sdk
adduser -D builder
addgroup builder abuild
mkdir -p /var/cache/distfiles
su - builder << END_OF_SU
mkdir -p .abuild
echo 'PACKAGER="GNS3 Packer <packer@gns3-registry>"' > .abuild/abuild.conf
abuild-keygen -a -n -q
git clone --depth 1 git://git.alpinelinux.org/aports
cd aports/*/"$package"
abuild -r
END_OF_SU
alpine_version=$(cat /etc/alpine-release)
alpine_version=${alpine_version%.*}
mkdir -p "/package/${alpine_version}"
cp -p /home/builder/packages/*/*/*.apk "/package/${alpine_version}"
chown -R $(stat -c '%u:%g' /package) "/package/${alpine_version}"
EOF

View File

@ -1,20 +0,0 @@
#!/bin/sh
alpine_version=3.12
mkdir -p "$alpine_version"
docker run --rm -i -v "$PWD/$alpine_version:/package" alpine:$alpine_version << 'EOF'
cd
apk add alpine-sdk
mkdir -p .abuild
echo 'PACKAGER="GNS3 Packer <packer@gns3-registry>"' > .abuild/abuild.conf
abuild-keygen -a -n -q
git clone --depth 1 git://git.alpinelinux.org/aports
cd aports/*/ostinato
abuild -F -r
cd
cp -p packages/*/*/*.apk /package
chown $(stat -c '%u:%g' /package) /package/*
EOF

View File

@ -42,13 +42,13 @@ sed -i -E '/zebra|bgp|ospf|rip|isis|pim|ldp|eigrp|static|bfd/ s/= *no/=yes/' /et
echo "service integrated-vtysh-config" > /etc/frr/vtysh.conf
chown frr:frr /etc/frr/vtysh.conf
# reset terminal modes
sed -i "$(printf '1i\e[?5l\e[?7h\e[?8h')" /etc/motd
# run vtysh in .profile
cat > /root/.profile << 'EOF'
# ~/.profile: executed by Bourne-compatible login shells.
# reset terminal modes
[ -t 1 ] && printf '\e[?5l\e[?7h\e[?8h'
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc

View File

@ -40,13 +40,13 @@ setcap cap_net_admin,cap_net_raw=eip /usr/bin/drone
addgroup user ostinato
addgroup user wireshark
# reset terminal modes
sed -i "$(printf '1i\e[?5l\e[?7h\e[?8h')" /etc/motd
# create .profile
cat > /root/.profile << 'EOF'
# ~/.profile: executed by Bourne-compatible login shells.
# reset terminal modes
[ -t 1 ] && printf '\e[?5l\e[?7h\e[?8h'
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc

View File

@ -1,13 +1,13 @@
# install additional packages
apk add nano busybox-extras
# reset terminal modes
sed -i "$(printf '1i\e[?5l\e[?7h\e[?8h')" /etc/motd
# create .profile
cat > /root/.profile << 'EOF'
# ~/.profile: executed by Bourne-compatible login shells.
# reset terminal modes
[ -t 1 ] && printf '\e[?5l\e[?7h\e[?8h'
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc