From 4896a47769a86edae82f94f26c8670dccdbc709b Mon Sep 17 00:00:00 2001 From: xf0r3m Date: Mon, 7 Aug 2023 18:34:00 +0200 Subject: [PATCH] =?utf8?q?database.csv=20-=20dodanie=20pola=20z=20nazw?= =?utf8?q?=C4=85=20domy=C5=9Blnego=20u=C5=BCytkownika=20(b=C4=99dzie=20pot?= =?utf8?q?rzebna=20do=20nowych=20funkcji);=20idle.sh=20-=20wskazanie=20now?= =?utf8?q?ego=20numeru=20pola=20z=20nazw=C4=85=20obrazu,=20zabezpieczenie?= =?utf8?q?=20funkcji=20'idle-fetch-containers'=20przed=20wykonaniem=20czyn?= =?utf8?q?no=C5=9Bci=20przed=20zaincjowaniem=20lxd?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- database.csv | 24 +++++++--------- idle.sh | 81 ++++++++++++++++++++++++++++------------------------ 2 files changed, 54 insertions(+), 51 deletions(-) diff --git a/database.csv b/database.csv index 2eb41ca..0cfdd42 100644 --- a/database.csv +++ b/database.csv @@ -1,13 +1,11 @@ -images:alpine/edge/amd64;10.1M;alpine-edge;alpine.sh;Alpine edge amd64 (20230714_13:01) -images:alt/Sisyphus/amd64;957M;alt-sisyphus;alt.sh;Alt Sisyphus amd64 (20230715_01:17) -images:archlinux;747M;archlinux;archlinux.sh;Archlinux current amd64 (20230715_04:18) -images:centos/9-Stream;446M;centos9;rpm.sh;Centos 9-Stream amd64 (20230714_07:08) -images:debian/sid;425M;debian;deb.sh;Debian sid amd64 (20230715_05:24) -images:fedora/Rawhide;504M;fedora;fedora.sh;Fedora Rawhide amd64 (20230714_20:33) -images:gentoo/systemd;1900M;gentoo;gentoo.sh;Gentoo current amd64 (20230714_17:43) -images:kali;389M;kali;deb.sh;Kali current amd64 (20230714_17:15) -images:opensuse/tumbleweed;193M;opensuse;opensuse.sh;Opensuse tumbleweed amd64 (20230715_04:20) -images:openwrt/snapshot;12.4M;openwrt;openwrt.sh;Openwrt snapshot amd64 (20230714_11:57) -images:rockylinux/9;435M;rocky9;rpm.sh;Rockylinux 9 amd64 (20230715_02:06) -images:ubuntu/mantic;513M;ubuntu;deb.sh;Ubuntu mantic amd64 (20230714_07:42) -images:voidlinux;248M;void;void.sh;Voidlinux current amd64 (20230714_17:11) +images:alpine/edge/amd64;10.1M;alpine-edge;alpine.sh;alpuser;Alpine edge amd64 (20230714_13:01) +images:archlinux;747M;archlinux;archlinux.sh;archuser;Archlinux current amd64 (20230715_04:18) +images:debian/sid;425M;debian;deb.sh;debuser;Debian sid amd64 (20230715_05:24) +images:fedora/Rawhide;504M;fedora;fedora.sh;rhuser;Fedora Rawhide amd64 (20230714_20:33) +images:gentoo/systemd;1900M;gentoo;gentoo.sh;gentoouser;Gentoo current amd64 (20230714_17:43) +images:kali;389M;kali;deb.sh;debuser;Kali current amd64 (20230714_17:15) +images:opensuse/tumbleweed;193M;opensuse;opensuse.sh;suseuser;Opensuse tumbleweed amd64 (20230715_04:20) +images:openwrt/snapshot;12.4M;openwrt;openwrt.sh;openwrt;Openwrt snapshot amd64 (20230714_11:57) +images:rockylinux/9;435M;rocky9;rpm.sh;rhuser;Rockylinux 9 amd64 (20230715_02:06) +images:ubuntu/mantic;513M;ubuntu;deb.sh;debuser;Ubuntu mantic amd64 (20230714_07:42) +images:voidlinux;248M;void;void.sh;voiduser;Voidlinux current amd64 (20230714_17:11) diff --git a/idle.sh b/idle.sh index 652971d..809ae3b 100644 --- a/idle.sh +++ b/idle.sh @@ -50,7 +50,7 @@ function idle-list-containers() { else installed="\e[31m\u2716\e[0m"; fi - desc=$(grep "$container" $DATABASE | cut -d ";" -f 5); + desc=$(grep "$container" $DATABASE | cut -d ";" -f 6); echo -e "${container}: $desc $installed"; done fi @@ -105,43 +105,48 @@ function idle-fetch-containers() { done } - if [ "$1" ]; then - if [ "$1" = "--all" ]; then - containerNameList=$(cut -d ";" -f 3 $DATABASE | awk '{printf $1" "}'); - for contName in $containerNameList; do - create-container $contName; - done - elif [ "$1" = "--deb" ]; then - mass-create-container $debGrepOpts; - elif [ "$1" = "--rpm" ]; then - mass-create-container $rpmGrepOpts; - elif [ "$1" = "--other" ]; then - mass-create-container $otherGrepOpts; - elif echo $1 | grep -q '\,'; then - mass-create-container $1; - else - contName=$1; - create-container $contName; - fi + if ! lxc profile show default | grep -q 'idle'; then + echo -e "${RED}LXD isn't initialized. You must run 'idle-lxd-init' firs${ENDCOLOR}"; + exit 1; else - echo "idle-fetch-containers - fetch IDLE containers"; - echo "IDLE Project @ 2023 morketsmerke.org"; - echo; - echo "Usage: "; - echo "$ idle-fetch-containers <--all/container_name/group_containers>"; - echo; - echo "Containers name:"; - for contName in $(cut -d ";" -f 3 $DATABASE | awk '{printf $1" "}'); do - echo -e " ${contName}"; - done - echo; - echo "Groups:"; - echo -e " --deb - based on APT package manager"; - list-containers $debGrepOpts; - echo -e " --rpm - based on RPM package manager"; - list-containers $rpmGrepOpts; - echo -e " --other - other containers not fit to above groups:"; - list-containers $otherGrepOpts; - return 1; + if [ "$1" ]; then + if [ "$1" = "--all" ]; then + containerNameList=$(cut -d ";" -f 3 $DATABASE | awk '{printf $1" "}'); + for contName in $containerNameList; do + create-container $contName; + done + elif [ "$1" = "--deb" ]; then + mass-create-container $debGrepOpts; + elif [ "$1" = "--rpm" ]; then + mass-create-container $rpmGrepOpts; + elif [ "$1" = "--other" ]; then + mass-create-container $otherGrepOpts; + elif echo $1 | grep -q '\,'; then + mass-create-container $1; + else + contName=$1; + create-container $contName; + fi + else + echo "idle-fetch-containers - fetch IDLE containers"; + echo "IDLE Project @ 2023 morketsmerke.org"; + echo; + echo "Usage: "; + echo "$ idle-fetch-containers <--all/container_name/group_containers>"; + echo; + echo "Containers name:"; + for contName in $(cut -d ";" -f 3 $DATABASE | awk '{printf $1" "}'); do + echo -e " ${contName}"; + done + echo; + echo "Groups:"; + echo -e " --deb - based on APT package manager"; + list-containers $debGrepOpts; + echo -e " --rpm - based on RPM package manager"; + list-containers $rpmGrepOpts; + echo -e " --other - other containers not fit to above groups:"; + list-containers $otherGrepOpts; + return 1; + fi fi } -- 2.39.5