-
Notifications
You must be signed in to change notification settings - Fork 0
/
s_tools_usb_tasks
executable file
·43 lines (36 loc) · 1.19 KB
/
s_tools_usb_tasks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
#
# Bin is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Bin is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Bin. If not, see <https://www.gnu.org/licenses/>.
#
# DEBUG
set -euo pipefail
# TODO
# - check if usb stick is plugged on.
s_echo "USB Tasks"
ARCHIVED="$HOME/Downloads/archived"
DISTRO="$(awk '/^NAME=/ { split($0,a,"="); print a[2] }' /etc/os-release)"
USB_NAME="MACHO"
USB=""
case $DISTRO in
"NixOS" | "Arch Linux" | "Manjaro")
USB="/run/media"
;;
"Debian GNU/Linux" | "Fedora")
USB="/media"
;;
esac
mkdir -pv "$ARCHIVED"
find "$ARCHIVED" -name "*.tar" | parallel --max-args=1 cp -rpv "{1}" "$USB/$USER/$USB_NAME/dots"
# LEGACY
# "$(grep '^NAME=' /etc/os-release | cut -f2 -d"=" | tr -d '"')"