diff --git a/01-toolchain b/01-toolchain index 9412132..9095440 100755 --- a/01-toolchain +++ b/01-toolchain @@ -1,5 +1,14 @@ #!/bin/bash -e +if type -p "sudo" &>/dev/null; then + PRIV="sudo" +elif type -p "doas" &>/dev/null; then + PRIV="doas" +else + echo "\e[1;31merror:\e[0m sudo/doas not found!" + exit 1 +fi + fetch() { tarballname=$(echo $1 | rev | cut -d / -f 1 | rev) WGETCMD="wget --passive-ftp --tries=3 --waitretry=3 --output-document=$2/$tarballname.partial" @@ -94,7 +103,7 @@ main() { checkdone || continue build_stage1 $script done - sudo chown -Rv 0:0 $LFS + $PRIV chown -Rv 0:0 $LFS } if [ $(id -u) = 0 ]; then @@ -129,15 +138,15 @@ export LC_ALL=C PATH MAKEFLAGS LFS LFS_TGT LFS_TGT32 mkdir -p $SRCDIR $PKGDIR $WORKDIR if [ ! -d $LFS/tools ]; then - sudo mkdir -pv $LFS/tools + $PRIV mkdir -pv $LFS/tools fi if [ ! -w $LFS ]; then - sudo chown -Rv $USER:$USER $LFS + $PRIV chown -Rv $USER:$USER $LFS fi if [ ! -L /tools ] || [ $(realpath /tools) != $LFS/tools ]; then - sudo ln -svf $LFS/tools / + $PRIV ln -svf $LFS/tools / fi main $@ diff --git a/README.md b/README.md index 60fa2d3..6d57c87 100755 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This repo contain scripts to automate multilib LFS build + livecd. This LFS buil ### Requirements -* sudo +* sudo/doas * wget * passes lfs version-check.sh test * squashfs-tools & libisoburn (optional to create the livecd iso) @@ -44,7 +44,7 @@ Basically you just need to run all those 3 scripts without other command to get ``` $ ./01-toolchain && sudo ./02-base && sudo ./03-mkiso ``` -> Note: script 01-toolchain gonna ask for sudo password +> Note: script 01-toolchain gonna ask for sudo/doas password - First grab any distro's livecd to use as host, or you can just your current running linux distro as host. (read below for tested host) - Prepare your partition for LFS and mount it on `/mnt/lfs` or you can change where LFS build directory in `config` file.