libdevuansdk/zlibs/helpers

81 lines
2.8 KiB
Bash

#!/usr/bin/env zsh
# Copyright (c) 2016 Dyne.org Foundation
# libdevuansdk is maintained by Ivan J. <parazyd@dyne.org>
#
# This file is part of libdevuansdk
#
# This source code 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 software 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 source code. If not, see <http://www.gnu.org/licenses/>.
## helper functions that make your life easier
devprocsys() {
fn devprocsys "$@"
local watdo="$1"
local werdo="$2"
req=(watdo werdo)
ckreq || return 1
if [[ $watdo = mount ]]; then
sudo mount -o bind /sys $werdo/sys && act "mounted sys"
sudo mount -t proc proc $werdo/proc && act "mounted proc"
sudo mount -o bind /dev $werdo/dev && act "mounted dev"
sudo mount -o bind /dev/pts $werdo/dev/pts && act "mounted dev/pts"
elif [[ $watdo = umount ]]; then
sudo umount $werdo/dev/pts && act "umounted dev/pts" && sleep 2
sudo umount $werdo/dev && act "umounted dev" && sleep 2
sudo umount $werdo/proc && act "umounted proc" && sleep 2
sudo umount $werdo/sys && act "umounted sys" && sleep 2
fi
}
silly() {
fn silly "$@"
local arg1="$1"
local arg2="$2"
## cheers mailpile!
funneh=("do not think of purple hippos"
"increasing entropy & scrambling bits"
"indexing kittens..."
"patching bugs..."
"spinning violently around the y-axis"
"warming up particle accelerator"
"this server is powered by a lemon and two electrodes"
"becoming self-aware"
"BCC-ing ALL THE SPIES!"
"all of your config settings & passwords are encrypted with AES256"
"the most common password is 123456, hopefully yours is different"
"good things come to those who wait"
"Make Free Software and be happy"
"We like volcanos, do you like volcanos?"
"Crossing out swear words..."
"Informing David Cameron of suspicious ac^H^H^H ... naaah :)"
"Abandon all hope, ye who enter here"
"Compiling bullshit bingo grid..."
"Estimating chance of asteroid hitting Earth"
"Applying coupons..."
"Backing up the entire Internet..."
"Making you wait for no reason"
"Doing nothing"
"Pay no attention to the man behind the curtain"
"You are great just the way you are"
"Supplying monkeys with typewriters"
"Swapping time and space"
"Self potato"
"it's all lies"
"A million hamsters are spinning their wheels right now"
)
local rnd=$(shuf -i1-30 -n 1)
act "${funneh[$rnd]}" ; [[ $arg1 = sleep ]] && sleep $arg2
}