From 7c48245b6f4677e2d0993b6cc169e4be11ab64ba Mon Sep 17 00:00:00 2001 From: Joaquin Date: Mon, 17 Apr 2023 03:02:23 +0300 Subject: [PATCH 1/3] [dev] Start work on better output Start work on cleaner output and --verbose flag for current output --- Dockerfile | 2 +- README.md | 2 +- koffe | 46 ++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3d65c55..45cdc25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM archlinux -ENV TERM='xterm' +ENV TERM='xterm-256color' RUN install -d /usr/bin/ RUN install -d /usr/share/koffe RUN install -d /finalimage diff --git a/README.md b/README.md index aa86a4d..10cec5d 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ If you're using another distrbution create a chroot system (using the bootstrap ## 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\\` # Converting a standard Arch USB to koffe without any other OS (internet required): diff --git a/koffe b/koffe index 950cec3..45528a2 100755 --- a/koffe +++ b/koffe @@ -2,8 +2,27 @@ x=1 pts=/usr/share/koffe/ pathto=$PWD +reset="\e[0m" +green="\e[0;32m" optdep=0 +quiet=0 pactree_command="pactree -su " +pacout=/dev/stdout +clearcomm='clear ; outapp' +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 ]; then for argument in $@ @@ -62,6 +81,13 @@ then optdep=1 pactree_command="pactree -suo " fi + if [[ $argument == "-v" ]]; + then + verbose=1 + pacout=/dev/stdout + clearcomm="echo" + fi + done fi if [ $(whoami) != root ]; @@ -87,7 +113,9 @@ fi if [ $(whoami) == root ]; then #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/l/ mkdir /tmp/koffe/n/ @@ -108,11 +136,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>&-) fi prog="$prog libnewt" + + for app in $prog do + clear + outapp PACAUR=0 - clear - echo $app variable=$(pacman -Sg $app) if [[ $variable == '' ]]; then @@ -130,7 +160,8 @@ then 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' ' ')" fi - wget -nc -i /tmp/koffe/l/$app -P /tmp/koffe/rootfs/airootfs/root/pkg/ + wget -q --show-progress -nc -i /tmp/koffe/l/$app -P /tmp/koffe/rootfs/airootfs/root/pkg/ + $clearcomm fi if [[ $aurornot == "error" ]]; @@ -159,7 +190,8 @@ then done pacman -Spdd --noconfirm - < /tmp/koffe/grtree > /tmp/koffe/grlinks - wget -nc -i /tmp/koffe/grlinks -P /tmp/koffe/rootfs/airootfs/root/pkg/ + wget -q --show-progress -nc -i /tmp/koffe/grlinks -P /tmp/koffe/rootfs/airootfs/root/pkg/ + $clearcomm fi if [[ $PACAUR == 1 ]]; then @@ -180,7 +212,8 @@ then then pactree -su $depend > /tmp/koffe/n/$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 -q --show-progress -nc -i /tmp/koffe/l/$depend -P /tmp/koffe/rootfs/airootfs/root/pkg/ + $clearcomm fi if [[ $aurdep_aur == "error" ]]; then @@ -189,6 +222,7 @@ then cd /tmp/koffe/aurbg/$depend sudo -u nobody makepkg --noconfirm --skippgpcheck cp /tmp/koffe/aurbg/$depend/*.pkg.tar.zst /tmp/koffe/rootfs/airootfs/root/pkg + $clearcomm fi done declare -a bbm From 5db12c45a6a3455011765e95a9b534e4bc1f1b38 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Mon, 17 Apr 2023 14:58:07 +0300 Subject: [PATCH 2/3] [dev] Work on quiet mode Made quiet mode default and added a -v (verbose) option for legacy output --- koffe | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/koffe b/koffe index 45528a2..e033e33 100755 --- a/koffe +++ b/koffe @@ -9,6 +9,9 @@ quiet=0 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 @@ -20,7 +23,7 @@ outapp(){ fi done echo - echo "----------------------------" + echo ">-------------------------------------------------<" echo } if [ $1 ]; @@ -35,6 +38,8 @@ then echo echo "Flags:" echo + echo " koofe -v --> verbose output" + echo echo " koffe --pacs=Prog1,Prog2 --> starts koffe and creates" echo " an iso with the programs Prog1 and Prog2" echo " IMPORTANT: Separate the progs with commas" @@ -86,6 +91,9 @@ then verbose=1 pacout=/dev/stdout clearcomm="echo" + wgetargs="" + quiet_flag="" + verbose_flag="-v" fi done @@ -160,7 +168,7 @@ then 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' ' ')" fi - wget -q --show-progress -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 @@ -190,7 +198,7 @@ then done pacman -Spdd --noconfirm - < /tmp/koffe/grtree > /tmp/koffe/grlinks - wget -q --show-progress -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 if [[ $PACAUR == 1 ]]; @@ -212,7 +220,7 @@ then then pactree -su $depend > /tmp/koffe/n/$depend pacman -Spdd --noconfirm - < /tmp/koffe/n/$depend > /tmp/koffe/l/$depend - wget -q --show-progress -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 if [[ $aurdep_aur == "error" ]]; @@ -229,17 +237,29 @@ then 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 do - pacman -S $depend --noconfirm + echo "--> Install $depend (needed to build the AUR package)?" + pacman -S $depend --noconfirm > $pacout 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 fi 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 - 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/rootfs//airootfs/root/* rm -rf /tmp/koffe/ + echo "Done!" + echo + echo "quit" fi From 41a53674331a2b06fa706db144856c724e731f16 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Mon, 17 Apr 2023 15:17:01 +0300 Subject: [PATCH 3/3] [typo] Fix typo and Docs Last commit on dev before merge to main --- README.md | 2 ++ koffe | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 10cec5d..e486a0c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ koffe [options] Flags: + koffe -v --> verbose output + koffe --pacs=Prog1,Prog2 --> starts koffe and creates an iso with the programs Prog1 and Prog2 IMPORTANT: Separate the progs with commas diff --git a/koffe b/koffe index e033e33..b26b758 100755 --- a/koffe +++ b/koffe @@ -38,7 +38,7 @@ then echo echo "Flags:" echo - echo " koofe -v --> verbose output" + echo " koffe -v --> verbose output" echo echo " koffe --pacs=Prog1,Prog2 --> starts koffe and creates" echo " an iso with the programs Prog1 and Prog2"