Added suport for bash auto-complete and config options for downloading burrow from the repo

This commit is contained in:
B.J. Dweck 2020-09-03 00:02:54 +02:00
parent 8f3c43116e
commit fac7876b18
6 changed files with 56 additions and 13 deletions

View File

@ -147,7 +147,10 @@ export PI_GEN=${PI_GEN:-pi-gen}
export PI_GEN_REPO=${PI_GEN_REPO:-https://github.com/RPi-Distro/pi-gen} export PI_GEN_REPO=${PI_GEN_REPO:-https://github.com/RPi-Distro/pi-gen}
export IMG_NAME="${IMG_NAME:-RasbianBurrow}" export IMG_NAME="${IMG_NAME:-RasbianBurrow}"
export RUDEFOX_BURROW_VERSION=${RUDEFOX_BURROW_VERSION:-"0.0.2"} export RUDEFOX_REPO_USERNAME="${RUDEFOX_REPO_USERNAME:-anonymous}"
export RUDEFOX_REPO_PASSWORD="${RUDEFOX_REPO_PASSWORD:-default}"
export RUDEFOX_BURROW_VERSION="${RUDEFOX_BURROW_VERSION:-latest}"
export USE_QEMU="${USE_QEMU:-0}" export USE_QEMU="${USE_QEMU:-0}"
export IMG_DATE="${IMG_DATE:-"$(date +%Y-%m-%d)"}" export IMG_DATE="${IMG_DATE:-"$(date +%Y-%m-%d)"}"
export IMG_FILENAME="${IMG_FILENAME:-"${IMG_DATE}-${IMG_NAME}"}" export IMG_FILENAME="${IMG_FILENAME:-"${IMG_DATE}-${IMG_NAME}"}"

View File

@ -1,11 +1,36 @@
#!/bin/bash -e #!/bin/bash
mkdir -p "${ROOTFS_DIR}/opt/" export RUDEFOX_REPO_BASE_URL="https://repo.rudefox.io"
rm -rf "${ROOTFS_DIR}/opt/rudefox-burrow" export RUDEFOX_REPO_RELEASES="maven-releases"
wget "https://repo.rudefox.io/repository/maven-public/io/rudefox/burrow/${RUDEFOX_BURROW_VERSION}/burrow-${RUDEFOX_BURROW_VERSION}.tar" export RUDEFOX_GROUP="io.rudefox"
tar -C "${ROOTFS_DIR}/opt/" -xvf burrow*.tar export RUDEFOX_BURROW_ID="burrow"
mv "${ROOTFS_DIR}/opt/burrow-"* "${ROOTFS_DIR}/opt/rudefox-burrow" export OUTFILE="burrow.tar"
export WGET_OPTS="--https-only -O ${OUTFILE} -v"
export WGET_URL="${RUDEFOX_REPO_BASE_URL}/service/rest/v1/search/assets/download?group=${RUDEFOX_GROUP}&name=${RUDEFOX_BURROW_ID}&maven.extension=tar"
if [ $RUDEFOX_BURROW_VERSION != "latest" ]
then
export WGET_URL="${WGET_URL}&maven.baseVersion=${RUDEFOX_BURROW_VERSION}"
else
export WGET_URL="${WGET_URL}&sort=version"
fi
if [ $RUDEFOX_REPO_USERNAME != "anonymous" ]
then
export ENCODED_USERNAME=$(echo -n $RUDEFOX_REPO_USERNAME | base64 | sed 's/+/-/g; s/\//_/g; s/=/%3D/g';)
export ENCODED_PASSWORD=$(echo -n $RUDEFOX_REPO_PASSWORD | base64 | sed 's/+/-/g; s/\//_/g; s/=/%3D/g';)
export POST_DATA="username=${ENCODED_USERNAME}&password=${ENCODED_PASSWORD}"
wget --save-cookies cookies.txt --keep-session-cookies --post-data $POST_DATA "${RUDEFOX_REPO_BASE_URL}/service/rapture/session"
wget --load-cookies cookies.txt $WGET_OPTS $WGET_URL
rm cookies.txt
else
wget $WGET_OPTS "${WGET_URL}&repository=${RUDEFOX_REPO_RELEASES}"
fi
on_chroot <<EOF
ln -fs /opt/rudefox-burrow/bin/burrow /usr/bin/burrow
EOF

View File

@ -1,5 +1,10 @@
#!/bin/bash -e #!/bin/bash -e
echo "" >> "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.bashrc" mkdir -p "${ROOTFS_DIR}/opt/"
echo "unset HISTFILE" >> "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.bashrc" rm -rf "${ROOTFS_DIR}/opt/rudefox-burrow"
tar -C "${ROOTFS_DIR}/opt/" -xvf burrow.tar
mv "${ROOTFS_DIR}/opt/burrow-"* "${ROOTFS_DIR}/opt/rudefox-burrow"
on_chroot <<EOF
ln -fs /opt/rudefox-burrow/bin/burrow /usr/bin/burrow
EOF

View File

@ -0,0 +1,5 @@
#!/bin/bash -e
echo "" >> "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.bashrc"
echo ". <(burrow generate-completion)" >> "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.bashrc"

View File

@ -0,0 +1,5 @@
#!/bin/bash -e
echo "" >> "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.bashrc"
echo "unset HISTFILE" >> "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.bashrc"

View File

@ -6,7 +6,7 @@ install -m 644 files/enable-overlayfs.target "${ROOTFS_DIR}/etc/systemd/system/"
install -m 755 files/enable_overlayfs.sh "${ROOTFS_DIR}/usr/bin/" install -m 755 files/enable_overlayfs.sh "${ROOTFS_DIR}/usr/bin/"
on_chroot << EOF on_chroot << EOF
ln -s /etc/systemd/system/enable-overlayfs.service /etc/systemd/system/enable-overlayfs.target.wants/enable-overlayfs.service ln -sf /etc/systemd/system/enable-overlayfs.service /etc/systemd/system/enable-overlayfs.target.wants/enable-overlayfs.service
systemctl daemon-reload systemctl daemon-reload
systemctl set-default enable-overlayfs.target systemctl set-default enable-overlayfs.target
EOF EOF