Skip to content

Commit

Permalink
FIX: add param verify to bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
alealexpro100 committed Jan 31, 2023
1 parent 9e76543 commit ef4e2f3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 8 additions & 1 deletion bin/alpine-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@ if [[ -z $4 ]]; then
"Example: $0 x86_64 v3.13 https://nl.alpinelinux.org/alpine /mnt htop"
fi

arch=$1 version=$2 mirror="$3"; dir="$(realpath "$4")"; shift 4; add_packages="$*"
arch=$1 version=$2 mirror="$3" dir="$(realpath "$4")"; shift 4; add_packages="$*"

# Offline parameters verify
[[ $arch == "x86_64" || $arch == "aarch64" || $arch == "armhf" || $arch == "armv7" || $arch == "x86" ]] || return_err "Incorrect arch $arch! Supported: x86_64,x86,aarch64,armhf,armv7"
is_url "$mirror" || return_err "Link $mirror does not seem to be URL!"
[[ -d $dir ]] || return_err "Directory $dir does not exist!"

parse_arch "$(uname -m)"
if [[ $mirror =~ https* ]]; then
msg_print warning "Detected https mirror! Will try to use http for initial install."
# Due to new mechanism of download, we need to either ignore https or use temporary rootfs.
check_url "${mirror/https\:/http\:}" || return_err "Mirror $mirror does NOT support http!"
fi
if [[ $CUSTOM_ALPINE_REPO == "1" ]]; then
Expand Down
6 changes: 6 additions & 0 deletions bin/arch-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ fi
arch=$1 mirror=$2 dir="$(realpath "$3")"; shift 3
install_packages="$*"

# Offline parameters verify
[[ $arch == "x86_64" || $arch == "aarch64" || $arch == "arm" || $arch == "armv6h" || $arch == "armv7h" || $arch == "i686" ]] || return_err "Incorrect arch $arch! Supported: x86_64,i686,aarch64,arm,armv6h,armv7h"
is_url "$mirror" || return_err "Link $mirror does not seem to be URL!"
[[ -d $dir ]] || return_err "Directory $dir does not exist!"


parse_arch "$(uname -m)"
if [[ $arch == "$arch_arch" ]]; then
arch_chroot_command="chroot_rootfs auto"
Expand Down
8 changes: 7 additions & 1 deletion bin/void-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ fi

arch=$1 version=$2 mirror=$3 dir="$(realpath "$4")"; shift 4; add_packages="$*"

# Offline parameters verify
[[ $arch == "x86_64" || $arch == "aarch64" || $arch == "armv6l" || $arch == "armv7l" || $arch == "i686" ]] || return_err "Incorrect arch $arch! Supported: x86_64,aarch64,armv6l,armv7l"
[[ $arch != "i686" ]] || return_err "Arch $arch is not supported!"
[[ $version == "musl" || $version == "glibc" ]] || return_err "Incorrect version $version! Supported: musl,glibc."
is_url "$mirror" || return_err "Link $mirror does not seem to be URL!"
[[ -d $dir ]] || return_err "Directory $dir does not exist!"

parse_arch "$(uname -m)"
if [[ $arch == "$void_arch" ]]; then
arch_chroot_command="chroot_rootfs auto"
Expand All @@ -35,7 +42,6 @@ else
fi
fi

[[ $arch == "i686" ]] && return_err "Arch $arch is not supported!"
install_arch=$arch
if [[ "$arch" == "aarch64" ]]; then
repo_xbps="$mirror/$arch"
Expand Down

0 comments on commit ef4e2f3

Please sign in to comment.