From 2d5fffdf806ef0d53877c61efbdd614ee4b26e43 Mon Sep 17 00:00:00 2001 From: Kuoi Date: Tue, 19 Jul 2022 20:48:20 +0100 Subject: [PATCH] init --- Dockerfile | 19 +++++++++++++++++++ README.md | 32 ++++++++++++++++++++++++++++++++ gen_img.sh | 8 ++++++++ man_img.sh | 10 ++++++++++ wsl.service | 8 ++++++++ wsl.timer | 9 +++++++++ 6 files changed, 86 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100755 gen_img.sh create mode 100755 man_img.sh create mode 100644 wsl.service create mode 100644 wsl.timer diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eaf8e2e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM archlinux:latest + +# import bioarchlinux keyring +RUN pacman -Syu --noconfirm +RUN pacman-key --recv-keys B1F96021DB62254D +RUN pacman-key --finger B1F96021DB62254D +RUN pacman-key --init +RUN pacman-key --lsign-key B1F96021DB62254D + +# add bioarchlinux to pacman.conf +RUN curl https://raw.githubusercontent.com/BioArchLinux/mirror/main/pacman.conf.bio -o /etc/pacman.conf +RUN curl https://raw.githubusercontent.com/BioArchLinux/mirror/main/mirrorlist.bio -o /etc/pacman.d/mirrorlist.bio +RUN sed -i '2,2s/# //g' /etc/pacman.d/mirrorlist.bio + +# install keyring and mirrorlist packages +RUN pacman -Syu --noconfirm +RUN pacman -S --noconfirm bioarchlinux-keyring +RUN pacman -S --noconfirm --overwrite '*' bioarchlinux-mirrorlist +RUN rm -rf /var/cache/pacman/pkg diff --git a/README.md b/README.md new file mode 100644 index 0000000..948192e --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# BioArchLinux on WSL + +## Usage + +Download [wsl tar file](https://repo.bioarchlinux.org/wsl) from [any mirror](https://raw.githubusercontent.com/BioArchLinux/mirror/main/mirrorlist.bio) of BioArchLinux. + +Specific a `StoragePath` and run the following command under the tar file directory. + +``` +wsl --import BioArchLinux StoragePath .\bioarchlinux.tar +wsl -d BioArchLinux +``` + +then you need to choose a mirror of archlinux and bioarchlinux + +choose mirror of archlinux from [here](https://archlinux.org/mirrorlist/) and run the following command ( take sdu mirror as the example) + +``` +echo 'Server = https://mirrors.sdu.edu.cn/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist +``` + +choose mirror bioarchlinux from [here](https://raw.githubusercontent.com/BioArchLinux/mirror/main/mirrorlist.bio) and run the following command ( take sdu mirror as the example) + +``` +echo 'Server = https://mirrors.sdu.edu.cn/bioarchlinux/$arch' > /etc/pacman.d/mirrorlist.bio +``` + +Finally, you can install any packages from BioArchLinux +``` +pacman -Syu +pacman -S foo +``` diff --git a/gen_img.sh b/gen_img.sh new file mode 100755 index 0000000..2cfcd8f --- /dev/null +++ b/gen_img.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +docker build -t bioarchlinux:$(date "+%Y%m%d") . +docker run -d bioarchlinux:$(date "+%Y%m%d") +docker export $(docker ps -a | awk '{print $1}' |sed -n '2p') > bioarchlinux-$(date "+%Y%m%d").tar + +docker rm $(docker ps -aq) +docker rmi $(docker images -q) diff --git a/man_img.sh b/man_img.sh new file mode 100755 index 0000000..0d53b86 --- /dev/null +++ b/man_img.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +cd /usr/share/lilac/wsl + +git pull + +./gen_img.sh + +rm -rf /usr/share/lilac/Repo/wsl/* +mv bioarchlinux-$(date "+%Y%m%d").tar /usr/share/lilac/Repo/wsl/ diff --git a/wsl.service b/wsl.service new file mode 100644 index 0000000..0e54769 --- /dev/null +++ b/wsl.service @@ -0,0 +1,8 @@ +[Unit] +Description=wsl tar file generator +Wants=wsl.timer + +[Service] +User=root +Type=simple +ExecStart=/usr/share/lilac/wsl/man_img.sh diff --git a/wsl.timer b/wsl.timer new file mode 100644 index 0000000..963ce7a --- /dev/null +++ b/wsl.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Runs wsl generator the first day every month + +[Timer] +OnCalendar=*-*-01 01:00:00 +Unit=wsl.service + +[Install] +WantedBy=multi-user.target