mirror of
https://github.com/BioArchLinux/junest-img.git
synced 2025-03-10 06:44:01 +00:00
add: readme, script
This commit is contained in:
parent
11e74e2e2d
commit
97beedd5ef
2 changed files with 172 additions and 43 deletions
70
README.md
Normal file
70
README.md
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
# BioArchLinux on junest
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
[junest](https://github.com/fsquillace/junest) can let users manage the software via pacman under any Linux distributions. Non-root users can use it to install pkgs from BioArchLinux.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
- bash
|
||||||
|
|
||||||
|
- coreutils
|
||||||
|
|
||||||
|
- git/unzip
|
||||||
|
|
||||||
|
- curl/wget
|
||||||
|
|
||||||
|
### Install
|
||||||
|
|
||||||
|
```
|
||||||
|
curl -O https://raw.githubusercontent.com/BioArchLinux/junest-img/main/biojunest.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```
|
||||||
|
wget https://raw.githubusercontent.com/BioArchLinux/junest-img/main/biojunest.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
then
|
||||||
|
|
||||||
|
```
|
||||||
|
chmod +x biojunest.sh && ./biojunest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Advanced
|
||||||
|
|
||||||
|
You can also configure mirror, for example
|
||||||
|
|
||||||
|
```
|
||||||
|
./biojunest -m="https://mirrors.njupt.edu.cn/mirrors/bioarchlinux"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
You should `source` your `~/.zshrc` or `~/.bashrc` files firstly, for example
|
||||||
|
|
||||||
|
```
|
||||||
|
source ~/.bashrc
|
||||||
|
```
|
||||||
|
|
||||||
|
To enter junest, you can choose one of the following commands
|
||||||
|
|
||||||
|
```
|
||||||
|
junest -f
|
||||||
|
junest proot -f
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you can enjoy pacman
|
||||||
|
|
||||||
|
You can also use `sudoj` to replace `sudo` for using root privilege in host machine, for example
|
||||||
|
|
||||||
|
```
|
||||||
|
sudoj pacman -Syu
|
||||||
|
```
|
||||||
|
|
||||||
|
## Further information
|
||||||
|
|
||||||
|
See [here](https://github.com/fsquillace/junest)
|
145
biojunest.sh
145
biojunest.sh
|
@ -2,54 +2,113 @@
|
||||||
# This script downloads and installs junest with optional mirror and help options
|
# This script downloads and installs junest with optional mirror and help options
|
||||||
|
|
||||||
# Define the default mirror url
|
# Define the default mirror url
|
||||||
MIRROR="https://repo.bioarchlinux.org"
|
procarg () {
|
||||||
|
MIRROR="https://repo.bioarchlinux.org"
|
||||||
|
|
||||||
|
for arg in "$@"; do
|
||||||
|
case $arg in
|
||||||
|
-h)
|
||||||
|
echo "Usage: biojunest [-arguments]"
|
||||||
|
echo "Options:"
|
||||||
|
echo " -h, show this help message and exit"
|
||||||
|
echo " -m, set the mirror value"
|
||||||
|
echo " example: -m=\"https://repo.bioarchlinux.org\""
|
||||||
|
break
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
-m=*)
|
||||||
|
MIRROR="${arg#*=}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
break
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
echo "$MIRROR"
|
||||||
|
}
|
||||||
|
|
||||||
# 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
|
get_command (){
|
||||||
if command -v curl &> /dev/null && command -v zip &> /dev/null; then
|
local cmdtype=""
|
||||||
# Use curl to download the repository as a zip file and extract it
|
if command -v unzip &> /dev/null; then
|
||||||
curl -L https://github.com/fsquillace/junest/archive/refs/heads/master.zip -o ~/junest.zip
|
if command -v curl &> /dev/null; then
|
||||||
unzip junest.zip -d ~/.local/share/junest
|
cmdtype="zipcurl"
|
||||||
|
elif command -v wget &> /dev/null; then
|
||||||
|
cmdtype="zipwget"
|
||||||
|
else
|
||||||
|
echo "Error: curl or wget can\'t be found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
elif command -v git &> /dev/null; then
|
||||||
|
if command -v curl &> /dev/null; then
|
||||||
|
cmdtype="gitcurl"
|
||||||
|
elif command -v wget &> /dev/null; then
|
||||||
|
cmdtype="gitwget"
|
||||||
|
else
|
||||||
|
echo "Error: curl or wget can\'t be found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: unzip or git can\'t be found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo "$cmdtype"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc_junest (){
|
||||||
|
if [ "$1" = "zipcurl" ] || [ "$1" = "zipwget" ] ; then
|
||||||
|
if "$1" = "zipcurl"; then
|
||||||
|
curl -L https://github.com/fsquillace/junest/archive/refs/heads/master.zip -o ~/junest.zip
|
||||||
|
elif "$1" = "zipwget"; then
|
||||||
|
wget https://github.com/fsquillace/junest/archive/refs/heads/master.zip -O ~/junest.zip
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
unzip ~/junest.zip -d ~/.local/share/junest
|
||||||
rm ~/junest.zip
|
rm ~/junest.zip
|
||||||
curl -L "$MIRROR"/junest/bioarchlinux-junest.tar.gz -o ~/bioarchlinux-junest.tar.gz
|
elif [ "$1" = "gitcurl" ] || [ "$1" = "gitwget" ]; then
|
||||||
export PATH=~/.local/share/junest/bin:$PATH
|
git clone https://github.com/fsquillace/junest.git ~/.local/share/junest
|
||||||
junest s -i ~/bioarchlinux-junest.tar.gz
|
else
|
||||||
echo "Please add `export PATH=~/.local/share/junest/bin:$PATH` to your .zshrc or .bashrc"
|
echo "Error: Download junest!"
|
||||||
exit 0
|
return 1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Check if wget and zip are available
|
proc_img(){
|
||||||
if command -v wget &> /dev/null && command -v zip &> /dev/null; then
|
if [ "$1" = "gitcurl" ] || [ "$1" = "zipcurl" ]
|
||||||
# Use wget to download the repository as a zip file and extract it
|
then
|
||||||
wget https://github.com/fsquillace/junest/archive/refs/heads/master.zip -O junest.zip
|
curl -L "$2"/junest/bioarchlinux-junest.tar.gz -o ~/bioarchlinux-junest.tar.gz
|
||||||
unzip junest.zip -d ~/.local/share/junest
|
elif [ "$1" = "gitwget" ] || [ "$1" = "zipwget" ]
|
||||||
rm junest.zip
|
then
|
||||||
wget "$MIRROR"/junest/bioarchlinux-junest.tar.gz -O ~/bioarchlinux-junest.tar.gz
|
wget "$2"/junest/bioarchlinux-junest.tar.gz -O ~/bioarchlinux-junest.tar.gz
|
||||||
export PATH=~/.local/share/junest/bin:$PATH
|
else
|
||||||
junest s -i ~/bioarchlinux-junest.tar.gz
|
echo "Error:Download bioarchlinux img"
|
||||||
echo "Please add `export PATH=~/.local/share/junest/bin:$PATH` to your .zshrc or .bashrc"
|
return 1
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
export PATH=~/.local/share/junest/bin:$PATH
|
||||||
|
junest s -i ~/bioarchlinux-junest.tar.gz
|
||||||
|
rm ~/bioarchlinux-junest.tar.gz
|
||||||
|
}
|
||||||
|
|
||||||
# If none of the commands are available, print an error message and exit with non-zero code
|
set_env () {
|
||||||
echo "Error: curl/wget or zip are not available on this system."
|
|
||||||
exit 1
|
lines="PATH=\"\$PATH:~/.local/share/junest/bin:~/.junest/usr/bin_wrappers\"
|
||||||
|
JUNEST_ARGS=\"ns\""
|
||||||
|
|
||||||
|
if [ -z "$JUNEST_ARGS" ]; then
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
echo "$lines" >> "$1"
|
||||||
|
source "$1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
MIRROR=$(procarg "$@")
|
||||||
|
cmdtype=$(get_command)
|
||||||
|
proc_junest "$cmdtype"
|
||||||
|
proc_img "$cmdtype" "$MIRROR"
|
||||||
|
set_env ~/.bashrc
|
||||||
|
set_env ~/.zshrc
|
||||||
|
|
Loading…
Add table
Reference in a new issue