OSDN Git Service

add instantinstall
authorpaperbenni <paperbenni@gmail.com>
Thu, 16 Jul 2020 14:51:41 +0000 (16:51 +0200)
committerpaperbenni <paperbenni@gmail.com>
Thu, 16 Jul 2020 14:51:41 +0000 (16:51 +0200)
programs/checkinternet [changed mode: 0644->0755]
programs/fakecurl [changed mode: 0644->0755]
programs/instantinstall [new file with mode: 0755]
programs/instantpassword [changed mode: 0644->0755]
programs/instantterminalhelp [changed mode: 0644->0755]
programs/instantxsession [changed mode: 0644->0755]
programs/ipicom [changed mode: 0644->0755]
programs/iswitch [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/programs/instantinstall b/programs/instantinstall
new file mode 100755 (executable)
index 0000000..03fb232
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# program that prompts the user to install a package if it is not already installed
+
+if [ -z "$1" ]; then
+    echo "no package to check"
+    exit
+fi
+
+checkpackage() {
+    if command -v "$1" || pacman -Qi "$1"; then
+        echo "package $1 found"
+        exit
+    fi
+    return 1
+}
+
+checkpackage "$1"
+
+if ! checkinternet; then
+    imenu -e "internet is required"
+    exit 1
+fi
+
+if ! imenu -c "the extra package $1 is required. Download now?"; then
+    echo "package will not be installed"
+    exit 1
+fi
+
+st -e "bash" -c "sudo pacman -S --needed --noconfirm $1 && exit"
+
+checkpackage "$1" || exit 1
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)