aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-04-07 10:25:03 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-04-07 10:25:03 -0300
commit5cbd294d9fb1587926119e60a00dc3e66a3c1416 (patch)
tree0b50eff2e093ce900246a8411a1fc28e3a3a5b34
parentf68b373961614900fa299e9136e693168440b1db (diff)
downloadtrashman-5cbd294d9fb1587926119e60a00dc3e66a3c1416.tar.gz
trashman-5cbd294d9fb1587926119e60a00dc3e66a3c1416.tar.bz2
Adds hoarder for local installs
-rw-r--r--README.md7
-rw-r--r--TODO.md3
l---------hoarder1
-rw-r--r--share/hoarder/mps-youtube/info1
-rwxr-xr-xshare/hoarder/mps-youtube/unix/linux/debian/install11
-rw-r--r--share/hoarder/rainbowstream/info1
-rwxr-xr-xshare/hoarder/rainbowstream/unix/linux/debian/install10
-rw-r--r--share/trashman/trashman/debian14
-rw-r--r--share/trashman/trashman/functions7
-rwxr-xr-xtrashman16
10 files changed, 61 insertions, 10 deletions
diff --git a/README.md b/README.md
index 5e351d4..cf9abc7 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,13 @@ you have to add files into `/etc/apt/trusted.gpg.d`, `trashman` will provide tho
keys or fingerprints instead of donwloading it from somewhere, in which case it could
be easily tampered.
+## Hoarder
+
+Hoarder is trashman's companion, an equivalent script intended to install packages
+locally, at the current user's folder:
+
+ hoarder install <package>
+
## Features
* Multi-arch, multi-OS: you might code packages for any distro,
diff --git a/TODO.md b/TODO.md
index 0b643cf..371a7a7 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,6 +1,7 @@
TODO
====
-* Multi-licensing and note on the lack of licensing for some scripts.
* Support more OSes at `__trashman_distro()`.
* Argument passing to distro/action scripts as `--param=value`.
+* Run check action (if available) before testing/installing/removing.
+* Multi-licensing and note on the lack of licensing for some scripts.
diff --git a/hoarder b/hoarder
new file mode 120000
index 0000000..aa65f72
--- /dev/null
+++ b/hoarder
@@ -0,0 +1 @@
+trashman \ No newline at end of file
diff --git a/share/hoarder/mps-youtube/info b/share/hoarder/mps-youtube/info
new file mode 100644
index 0000000..1a8b940
--- /dev/null
+++ b/share/hoarder/mps-youtube/info
@@ -0,0 +1 @@
+terminal based youtube player and downloader
diff --git a/share/hoarder/mps-youtube/unix/linux/debian/install b/share/hoarder/mps-youtube/unix/linux/debian/install
new file mode 100755
index 0000000..46781af
--- /dev/null
+++ b/share/hoarder/mps-youtube/unix/linux/debian/install
@@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+#
+# Install mps-youtube
+# https://github.com/mps-youtube/mps-youtube
+
+# Requirements
+trashman_apt_install_packages python3-pip mpv
+pip3 install --user youtube-dl
+
+# Install
+pip3 install --user -U git+https://github.com/mps-youtube/mps-youtube.git
diff --git a/share/hoarder/rainbowstream/info b/share/hoarder/rainbowstream/info
new file mode 100644
index 0000000..02c86c9
--- /dev/null
+++ b/share/hoarder/rainbowstream/info
@@ -0,0 +1 @@
+a smart and nice twitter client on terminal written in python
diff --git a/share/hoarder/rainbowstream/unix/linux/debian/install b/share/hoarder/rainbowstream/unix/linux/debian/install
new file mode 100755
index 0000000..aa46b9a
--- /dev/null
+++ b/share/hoarder/rainbowstream/unix/linux/debian/install
@@ -0,0 +1,10 @@
+#!/usr/bin/env sh
+#
+# Install rainbowstream
+# https://github.com/orakaro/rainbowstream
+
+# Requirements
+trashman_apt_install_packages python-pip python-dev libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
+
+# Install
+pip install --user rainbowstream
diff --git a/share/trashman/trashman/debian b/share/trashman/trashman/debian
index abf2612..1bdd504 100644
--- a/share/trashman/trashman/debian
+++ b/share/trashman/trashman/debian
@@ -3,12 +3,16 @@
# Custom functions for debian-like systems.
#
+trashman_apt_update() {
+ $SUDO apt-get update
+}
+
trashman_apt_install() {
if [ -z "$1" ]; then
return
fi
- LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y $*
+ LC_ALL=C DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y $*
}
# Machine architecture
@@ -41,12 +45,14 @@ trashman_apt_install_packages() {
return
fi
+ trashman_apt_update
+
for package in $*; do
trashman_apt_check $package
if [ "$?" = "1" ]; then
trashman_echo "Installing package $package..."
- DEBIAN_FRONTEND=noninteractive apt-get install $package -y || exit 1
+ DEBIAN_FRONTEND=noninteractive $SUDO apt-get install $package -y || exit 1
fi
done
}
@@ -60,6 +66,6 @@ trashman_install_apt_key() {
exit 1
fi
- cp $orig /etc/apt/trusted.gpg.d/$dest || exit 1
- chown root.root /etc/apt/trusted.gpg.d/$dest && chmod 644 /etc/apt/trusted.gpg.d/$dest || exit 1
+ $SUDO cp $orig /etc/apt/trusted.gpg.d/$dest || exit 1
+ $SUDO chown root.root /etc/apt/trusted.gpg.d/$dest && $SUDO chmod 644 /etc/apt/trusted.gpg.d/$dest || exit 1
}
diff --git a/share/trashman/trashman/functions b/share/trashman/trashman/functions
index 7478322..a870736 100644
--- a/share/trashman/trashman/functions
+++ b/share/trashman/trashman/functions
@@ -217,3 +217,10 @@ trashman_check_root() {
exit 1
fi
}
+
+# Check for sudo
+trashman_check_sudo () {
+ if [ "`whoami`" != "root" ]; then
+ SUDO="sudo"
+ fi
+}
diff --git a/trashman b/trashman
index 34a1247..4758a21 100755
--- a/trashman
+++ b/trashman
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
#
-# Provision: install stuff using scripts.
+# trashman handles junky software
#
# Copyright (C) 2017 Silvio Rhatto - rhatto at riseup.net
#
@@ -27,14 +27,16 @@ CWD="`pwd`"
# Set shared files location
if [ -e "`dirname $(readlink -f $0)`/share/$NAME" ]; then
# Development or local installation layout
- SHARE="`dirname $(readlink -f $0)`/share/$NAME"
+ LIB="`dirname $(readlink -f $0)`/share/$NAME"
+ SHARE="`dirname $(readlink -f $0)`/share/$BASENAME"
else
# System installation layout
- SHARE="`dirname $(readlink -f $0)`/../share/$NAME"
+ LIB="`dirname $(readlink -f $0)`/../share/$NAME"
+ SHARE="`dirname $(readlink -f $0)`/../share/$BASENAME"
fi
# Include basic functions
-. $SHARE/trashman/functions || exit 1
+. $LIB/trashman/functions || exit 1
# Display usage
trashman_usage() {
@@ -79,7 +81,11 @@ else
folder="`trashman_actions_folder $package`"
# Checking for privileges
- trashman_check_root $ACTION
+ if [ "$BASENAME" == "trashman" ]; then
+ trashman_check_root $ACTION
+ else
+ trashman_check_sudo
+ fi
if [ -x "$SHARE/$package/$folder/$ACTION" ]; then
if [ "$ACTION" != "check" ] && [ "$ACTION" != "test" ]; then