dot

packages and services management
Log | Files | Refs | README

commit b77779904c18437f9eeb0927d2d74c0a97242224
parent c3adca64731244e9b83fd2922401cfc434eaf050
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri, 22 Dec 2017 00:30:04 +0100

merging qemu-start and extract to xdg-open

Diffstat:
Dbin/extract | 20--------------------
Dbin/qemu-start | 6------
Mbin/xdg-open | 60+++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
3 files changed, 55 insertions(+), 31 deletions(-)

diff --git a/bin/extract b/bin/extract @@ -1,20 +0,0 @@ -#!/bin/sh -# extract an archive file given its extension - -for file in "$@" -do - case "$file" in - ( *.tar.gz | *.tgz ) tar -xzf "$file" ;; - ( *.tar.bz2 | *.tbz2 ) tar -xjf "$file" ;; - ( *.tar ) tar -xf "$file" ;; - ( *.bz2 ) bunzip2 "$file" ;; - ( *.gz ) gunzip "$file" ;; - ( *.rar ) unrar x "$file" ;; - ( *.zip ) unzip "$file" ;; - ( *.Z ) uncompress "$file" ;; - ( *.7z ) 7z x "$file" ;; - ( *.xz ) xz -d "$file" ;; - ( *.deb ) ar vx "$file" ;; - ( * ) exit 1 ;; - esac -done diff --git a/bin/qemu-start b/bin/qemu-start @@ -1,6 +0,0 @@ -#!/bin/sh - -exec doas qemu-system-x86_64 -m 4G -display curses \ - -device e1000,netdev=net0 \ - -netdev user,id=net0,hostfwd=tcp::5555-:22 \ - "$1" diff --git a/bin/xdg-open b/bin/xdg-open @@ -91,9 +91,9 @@ case $scheme in exec "$0" "$HOME/var/torrent/${path##*/}" ;; (*.jpg|*.JPG|*.jpeg|*.JPEG|*.png|*.PNG|*.gif) - mkdir -p "$HOME/lib/image/$host" - curl -Lo "$HOME/lib/image/$host" "$1" - exec "$0" "$HOME/lib/image/$host" + mkdir -p "$HOME/lib/http/image/$host" + curl -Lo "$HOME/lib/http/image/$host" "$1" + exec "$0" "$HOME/lib/http/image/$host" ;; (*.opus|*.ogg|*.mp3|*.flac) mkdir -p "$HOME/lib/http/music/$host" @@ -105,6 +105,11 @@ case $scheme in curl -Lo "$HOME/lib/http/video/$host/${path##*/}" "$1" exec "$0" "$HOME/lib/http/video/$host/${path##*/}" ;; + (*.txt) + mkdir -p "$HOME/lib/http/text/$host" + curl -Lo "$HOME/lib/http/text/$host/${path##*/}" "$1" + exec "$0" "$HOME/lib/http/text/$host/${path##*/}" + ;; esac for b in retawq firefox chromium chromium-browser chrome x-www-browser do command -v "$b" && break @@ -167,8 +172,11 @@ esac (*.webm|*.mp4|*.mkv|*.mp3|*.flac|*.ogg|*.opus) exec mplayer "$1" ;; -(*.img) - exec qemu-start "$1" +(*.img|*.iso) + exec doas qemu-system-x86_64 -m 500M \ + -device e1000,netdev=net0 \ + -netdev user,id=net0,hostfwd=tcp::5555-:22 \ + "$1" ;; (*.[0-9]|*.[0-9]p|*.[0-9].gz) exec mandoc -a "$1" @@ -179,6 +187,48 @@ esac (*/music/*|*.opus|*.mp3|*.flac) exec play "$1" ;; +(*.tar) + exec tar -xf "$1" + ;; +(*.tbz) + mv "$1" "${1%.tbz}.tar.bz2" + exec "$0" "${1%.tbz}.tar.bz2" + ;; +(*.bz2) + bzip2 -d "$1" + exec "$0" "${1%.bz2}" + ;; +(*.tgz) + mv "$1" "${1%.tgz}.tar.bz" + exec "$0" "${1%.tgz}.tar.gz" + ;; +(*.gz) + gzip -d "$1" + exec "$0" "${1%.gz}" + ;; +(*.tzz) + mv "$1" "${1%.txz}.tar.xz" + exec "$0" "${1%.txz}.tar.xz" + ;; +(*.xz) + xz -d "$1" + exec "$0" "${1%.xz}" + ;; +(*.rar) + exec unrar x "$1" + ;; +(*.zip) + exec unzip "$1" + ;; +(*.Z) + exec uncompress "$1" + ;; +(*.7z) + exec 7z x "$1" + ;; +(*.deb) + exec ar vx "$1" + ;; esac [ -d "$1" ] && exec io-src "$1"