Merge pull request #1 from KoNickss/dev

[feature] Add clean output display and -v verbose flag
main
Puly 3 years ago committed by GitHub
commit 1d213c4262
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Dockerfile
  2. 4
      README.md
  3. 74
      koffe

@ -1,5 +1,5 @@
FROM archlinux FROM archlinux
ENV TERM='xterm' ENV TERM='xterm-256color'
RUN install -d /usr/bin/ RUN install -d /usr/bin/
RUN install -d /usr/share/koffe RUN install -d /usr/share/koffe
RUN install -d /finalimage RUN install -d /finalimage

@ -10,6 +10,8 @@ koffe [options] <out folder>
Flags: Flags:
koffe -v --> verbose output
koffe --pacs=Prog1,Prog2 --> starts koffe and creates koffe --pacs=Prog1,Prog2 --> starts koffe and creates
an iso with the programs Prog1 and Prog2 an iso with the programs Prog1 and Prog2
IMPORTANT: Separate the progs with commas IMPORTANT: Separate the progs with commas
@ -52,7 +54,7 @@ If you're using another distrbution create a chroot system (using the bootstrap
## Then to run it: ## Then to run it:
`docker run -v $PWD:/finalimage --privileged --rm koffe --pacs=base,linux` `docker run -t -v $PWD:/finalimage --privileged --rm koffe --pacs=base,linux`
Note: On Windows, replace $PWD with an absolute path on your host, something like `c:\\Foo\\bar\\` Note: On Windows, replace $PWD with an absolute path on your host, something like `c:\\Foo\\bar\\`
# Converting a standard Arch USB to koffe without any other OS (internet required): # Converting a standard Arch USB to koffe without any other OS (internet required):

74
koffe

@ -2,8 +2,30 @@
x=1 x=1
pts=/usr/share/koffe/ pts=/usr/share/koffe/
pathto=$PWD pathto=$PWD
reset="\e[0m"
green="\e[0;32m"
optdep=0 optdep=0
quiet=0
pactree_command="pactree -su " pactree_command="pactree -su "
pacout=/dev/stdout
clearcomm='clear ; outapp'
wgetargs="-q --show-progress"
quiet_flag="-q"
verbose_flag=""
outapp(){
for outapp in $prog
do
if [[ $outapp == $app ]];
then
echo -ne "${green}$outapp${reset} "
else
echo -ne "$outapp "
fi
done
echo
echo ">-------------------------------------------------<"
echo
}
if [ $1 ]; if [ $1 ];
then then
for argument in $@ for argument in $@
@ -16,6 +38,8 @@ then
echo echo
echo "Flags:" echo "Flags:"
echo echo
echo " koffe -v --> verbose output"
echo
echo " koffe --pacs=Prog1,Prog2 --> starts koffe and creates" echo " koffe --pacs=Prog1,Prog2 --> starts koffe and creates"
echo " an iso with the programs Prog1 and Prog2" echo " an iso with the programs Prog1 and Prog2"
echo " IMPORTANT: Separate the progs with commas" echo " IMPORTANT: Separate the progs with commas"
@ -62,6 +86,16 @@ then
optdep=1 optdep=1
pactree_command="pactree -suo " pactree_command="pactree -suo "
fi fi
if [[ $argument == "-v" ]];
then
verbose=1
pacout=/dev/stdout
clearcomm="echo"
wgetargs=""
quiet_flag=""
verbose_flag="-v"
fi
done done
fi fi
if [ $(whoami) != root ]; if [ $(whoami) != root ];
@ -87,7 +121,9 @@ fi
if [ $(whoami) == root ]; if [ $(whoami) == root ];
then then
#updating the database is required for pacman to resolve the latest links to packages #updating the database is required for pacman to resolve the latest links to packages
pacman -Suy echo "Running 'pacman -Syu'"
pacman -Suy > $pacoutput
clear
mkdir /tmp/koffe/ mkdir /tmp/koffe/
mkdir /tmp/koffe/l/ mkdir /tmp/koffe/l/
mkdir /tmp/koffe/n/ mkdir /tmp/koffe/n/
@ -108,11 +144,13 @@ then
prog=$(whiptail --inputbox "Please enter all the programs to be included in the installer separated by a space, you can also include package groups like gnome or xorg or AUR packages" 0 0 4 3>&1 1>&2 2>&3 3>&-) prog=$(whiptail --inputbox "Please enter all the programs to be included in the installer separated by a space, you can also include package groups like gnome or xorg or AUR packages" 0 0 4 3>&1 1>&2 2>&3 3>&-)
fi fi
prog="$prog libnewt" prog="$prog libnewt"
for app in $prog for app in $prog
do do
clear
outapp
PACAUR=0 PACAUR=0
clear
echo $app
variable=$(pacman -Sg $app) variable=$(pacman -Sg $app)
if [[ $variable == '' ]]; if [[ $variable == '' ]];
then then
@ -130,7 +168,8 @@ then
pactree -su $app > /tmp/koffe/wout_opt pactree -su $app > /tmp/koffe/wout_opt
prog="$prog $(grep -Fxvf /tmp/koffe/wout_opt /tmp/koffe/with_opt | cut -d ':' -f 1 | cut -d '>' -f 1 | tr '\n' ' ')" prog="$prog $(grep -Fxvf /tmp/koffe/wout_opt /tmp/koffe/with_opt | cut -d ':' -f 1 | cut -d '>' -f 1 | tr '\n' ' ')"
fi fi
wget -nc -i /tmp/koffe/l/$app -P /tmp/koffe/rootfs/airootfs/root/pkg/ wget $wgetargs -nc -i /tmp/koffe/l/$app -P /tmp/koffe/rootfs/airootfs/root/pkg/
$clearcomm
fi fi
if [[ $aurornot == "error" ]]; if [[ $aurornot == "error" ]];
@ -159,7 +198,8 @@ then
done done
pacman -Spdd --noconfirm - < /tmp/koffe/grtree > /tmp/koffe/grlinks pacman -Spdd --noconfirm - < /tmp/koffe/grtree > /tmp/koffe/grlinks
wget -nc -i /tmp/koffe/grlinks -P /tmp/koffe/rootfs/airootfs/root/pkg/ wget $wgetargs -nc -i /tmp/koffe/grlinks -P /tmp/koffe/rootfs/airootfs/root/pkg/
$clearcomm
fi fi
if [[ $PACAUR == 1 ]]; if [[ $PACAUR == 1 ]];
then then
@ -180,7 +220,8 @@ then
then then
pactree -su $depend > /tmp/koffe/n/$depend pactree -su $depend > /tmp/koffe/n/$depend
pacman -Spdd --noconfirm - < /tmp/koffe/n/$depend > /tmp/koffe/l/$depend pacman -Spdd --noconfirm - < /tmp/koffe/n/$depend > /tmp/koffe/l/$depend
wget -nc -i /tmp/koffe/l/$depend -P /tmp/koffe/rootfs/airootfs/root/pkg/ wget $wgetargs -nc -i /tmp/koffe/l/$depend -P /tmp/koffe/rootfs/airootfs/root/pkg/
$clearcomm
fi fi
if [[ $aurdep_aur == "error" ]]; if [[ $aurdep_aur == "error" ]];
then then
@ -189,23 +230,36 @@ then
cd /tmp/koffe/aurbg/$depend cd /tmp/koffe/aurbg/$depend
sudo -u nobody makepkg --noconfirm --skippgpcheck sudo -u nobody makepkg --noconfirm --skippgpcheck
cp /tmp/koffe/aurbg/$depend/*.pkg.tar.zst /tmp/koffe/rootfs/airootfs/root/pkg cp /tmp/koffe/aurbg/$depend/*.pkg.tar.zst /tmp/koffe/rootfs/airootfs/root/pkg
$clearcomm
fi fi
done done
declare -a bbm declare -a bbm
bbm=$(cat /tmp/koffe/aurbg/$app/.SRCINFO | grep makedepends | cut -f 2 -d '=' | cut -f 1 -d '>' | cut -f 1 -d ':') bbm=$(cat /tmp/koffe/aurbg/$app/.SRCINFO | grep makedepends | cut -f 2 -d '=' | cut -f 1 -d '>' | cut -f 1 -d ':')
for depend in $bbm for depend in $bbm
do do
pacman -S $depend --noconfirm echo "--> Install $depend (needed to build the AUR package)?"
pacman -S $depend --noconfirm > $pacout
done done
sudo -u nobody makepkg --noconfirm --skippgpcheck sudo -u nobody makepkg --noconfirm --skippgpcheck > $pacout
cp /tmp/koffe/aurbg/$app/*.pkg.tar.zst /tmp/koffe/rootfs/airootfs/root/pkg cp /tmp/koffe/aurbg/$app/*.pkg.tar.zst /tmp/koffe/rootfs/airootfs/root/pkg
fi fi
done done
repo-add /tmp/koffe/rootfs/airootfs/root/pkg/koffe.db.tar.gz /tmp/koffe/rootfs/airootfs/root/pkg/* clear
echo -e "${green}-->${reset} Building REPO image"
repo-add $quiet_flag /tmp/koffe/rootfs/airootfs/root/pkg/koffe.db.tar.gz /tmp/koffe/rootfs/airootfs/root/pkg/* > $pacout
echo "Done!"
echo
echo "bash ~/install" > /tmp/koffe/rootfs/airootfs/root/.zshrc echo "bash ~/install" > /tmp/koffe/rootfs/airootfs/root/.zshrc
mkarchiso -v -w /tmp/koffe_workdir -o $pathto /tmp/koffe/rootfs/ echo -e "${green}-->${reset} Making ISO image (might take a while)"
mkarchiso $verbose_flag -L "koffe" -w /tmp/koffe_workdir -o $pathto /tmp/koffe/rootfs/ 2>&1 1>$pacout
echo "Done!"
echo
echo "--> Cleaning up"
rm -rf /tmp/koffe_workdir rm -rf /tmp/koffe_workdir
rm -rf /tmp/koffe/rootfs//airootfs/root/* rm -rf /tmp/koffe/rootfs//airootfs/root/*
rm -rf /tmp/koffe/ rm -rf /tmp/koffe/
echo "Done!"
echo
echo "quit"
fi fi

Loading…
Cancel
Save