dotfiles

config files and scripts at HOME.
git clone git://git.ricketyspace.net/dotfiles.git
Log | Files | Refs

commit e2cedb54e521ab720b7602259c8995fe4a598bcd
parent 3f0ebb40ef51316d2e718dca485b60a244c17119
Author: rsiddharth <s@ricketyspace.net>
Date:   Mon, 31 Oct 2016 22:43:46 +0000

Add .bin/u-lo

Script unmounts gibberish.

Diffstat:
.bin/u-lo | 42++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+), 0 deletions(-)

diff --git a/.bin/u-lo b/.bin/u-lo @@ -0,0 +1,42 @@ +#!/usr/bin/zsh +# +# Copyright (C) 2016 rsiddharth <s@ricketyspace.net> +# +# This program 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. +# +# This program 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 this program (see COPYING). If not, see +# <http://www.gnu.org/licenses/>. + +# unmount loop back device encrypted with cryptsetup +LO_NAME=$1 +LO_FILE_PATH=$2 + +[[ -z $LO_NAME ]] && + echo "ERROR: zarking give the name of loop device." && + exit 1 + +[[ -z $LO_FILE_PATH || ! -f $LO_FILE_PATH ]] && + echo 'ERROR: File path got fucked' && + exit 1 + +# unmount it +umnt $HOME/.mnt/$LO_NAME + +# remove mount directory +rmdir $HOME/.mnt/$LO_NAME + +# close loop back device +cryptsetup close $LO_NAME + +# detach +LO_DEV=$(losetup -n -O name -j $LO_FILE_PATH) +losetup -d $LO_DEV