This commit is contained in:
Kuoi 2023-05-08 02:33:23 +08:00
commit e5e06ed7d6
7 changed files with 127 additions and 0 deletions

5
Dockerfile Normal file
View file

@ -0,0 +1,5 @@
FROM bioarchlinux/bioarchlinux:latest
# import bioarchlinux keyring
RUN pacman -Syu --noconfirm bubblewrap git groot junest proot qemu-user-static sudo-fake yay
RUN mkdir /etc/junest && echo "JUNEST_ARCH=x86_64" >> /etc/junest/info
RUN rm -rf /var/cache/pacman/pkg

32
bio_junest.sh Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
# This script checks if git, curl or wget are available and downloads https://github.com/fsquillace/junest.git to ~/.junest
# Check if git is available
#if command -v git &> /dev/null; then
# Use git to clone the repository
# git clone https://github.com/fsquillace/junest.git ~/.junest
# exit 0
#fi
# Check if curl and zip are available
if command -v curl &> /dev/null && command -v zip &> /dev/null; then
# Use curl to download the repository as a zip file and extract it
curl -L https://github.com/fsquillace/junest/archive/refs/heads/master.zip -o junest.zip
unzip junest.zip -d ~/.junest
rm junest.zip
exit 0
fi
# Check if wget and zip are available
if command -v wget &> /dev/null && command -v zip &> /dev/null; then
# Use wget to download the repository as a zip file and extract it
wget https://github.com/fsquillace/junest/archive/refs/heads/master.zip -O junest.zip
unzip junest.zip -d ~/.junest
rm junest.zip
exit 0
fi
# If none of the commands are available, print an error message and exit with non-zero code
echo "Error: curl/wget or zip are not available on this system."
exit

55
biojunest.sh Executable file
View file

@ -0,0 +1,55 @@
#!/bin/bash
# This script downloads and installs junest with optional mirror and help options
# Define the default mirror url
MIRROR="https://repo.bioarchlinux.org"
# Parse the options using getopts
while getopts "m:h" opt; do
case $opt in
m) # Set the mirror url to the argument of -m option
MIRROR="$OPTARG"
;;
h) # Print the help message and exit
echo "Usage: ./install [-m MIRROR] [-h]"
echo " -m MIRROR Specify a mirror url to download junest from"
echo " -h Show this help message and exit"
exit 0
;;
\?) # Print an error message for invalid options and exit
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
# Check if curl and zip are available
if command -v curl &> /dev/null && command -v zip &> /dev/null; then
# Use curl to download the repository as a zip file and extract it
curl -L https://github.com/fsquillace/junest/archive/refs/heads/master.zip -o ~/junest.zip
unzip junest.zip -d ~/.local/share/junest
rm ~/junest.zip
curl -L "$MIRROR"/junest/bioarchlinux-junest.tar.gz -o ~/bioarchlinux-junest.tar.gz
export PATH=~/.local/share/junest/bin:$PATH
junest s -i ~/bioarchlinux-junest.tar.gz
echo "Please add `export PATH=~/.local/share/junest/bin:$PATH` to your .zshrc or .bashrc"
exit 0
fi
# Check if wget and zip are available
if command -v wget &> /dev/null && command -v zip &> /dev/null; then
# Use wget to download the repository as a zip file and extract it
wget https://github.com/fsquillace/junest/archive/refs/heads/master.zip -O junest.zip
unzip junest.zip -d ~/.local/share/junest
rm junest.zip
wget "$MIRROR"/junest/bioarchlinux-junest.tar.gz -O ~/bioarchlinux-junest.tar.gz
export PATH=~/.local/share/junest/bin:$PATH
junest s -i ~/bioarchlinux-junest.tar.gz
echo "Please add `export PATH=~/.local/share/junest/bin:$PATH` to your .zshrc or .bashrc"
exit 0
fi
# If none of the commands are available, print an error message and exit with non-zero code
echo "Error: curl/wget or zip are not available on this system."
exit 1

13
gen_junest.sh Executable file
View file

@ -0,0 +1,13 @@
# make image follow the junest image request
docker build -t junest .
# run image to export tar
docker run -d --name jun junest
docker export jun > bioarchlinux-junest.tar
# generate tar.gz
gzip bioarchlinux-junest.tar
# clean
docker rm jun --force
docker rmi junest --force

7
junest.service Normal file
View file

@ -0,0 +1,7 @@
[Unit]
Description=junest tar.gz file generator
Wants=junest.timer
[Service]
User=root
Type=simple
ExecStart=/usr/share/lilac/junest/man_junest.sh

7
junest.timer Normal file
View file

@ -0,0 +1,7 @@
[Unit]
Description=Runs junest generator every Mon
[Timer]
OnCalendar=Mon *-*-* 04:00:00
Unit=junest.service
[Install]
WantedBy=multi-user.target

8
man_junest.sh Executable file
View file

@ -0,0 +1,8 @@
cd /usr/share/lilac/junest
git pull
./gen_junest.sh
rm /usr/share/lilac/Repo/junest/*
mv bioarchlinux-junest.tar.gz /usr/share/lilac/Repo/junest/