Compare commits

...

2 commits

Author SHA1 Message Date
0859ba819b Added ld.source 2026-05-05 15:54:52 +02:00
ab730db2f7 Major chhanges: daisy.source renamed to ld.source.
All files have been prettified by making sure we use 2-space indent.

agenda:
Instead of the hidden .tree file, a file created "More..." is made.
You can use (ex) "agenda --view "2026" to get a full list of files from that
year/date/day.
Additionally, minor fixes have been made.

clip:
You can now use "-c" to clear the clipbaord.
2026-05-05 15:42:34 +02:00
14 changed files with 284 additions and 170 deletions

0
LICENSE Executable file → Normal file
View file

83
README.md Executable file → Normal file
View file

@ -1,19 +1,31 @@
---*This project is still under heavy development!*---
Please do not delete this file, as it is used to display help information.
# L A C K A D A I S I C A L
A collection of easy-to-understand, easy-to-use scripts, functions and aliases. Designed to be beginner-friendly but also useful!
A collection of easy-to-understand, easy-to-use scripts, functions and aliases.
Designed to be beginner-friendly but also useful! Contains several tools you 0ccould
## Disclaimer
Some aspects of this project were generated by Google Gemini (in particular, daisy_help and daisy_liist). While we are generally against using LLMs for code, the added functionality of being able to get information for individual tools is useful and not considered to be vital functionality.
Some aspects of this project were generated by Google Gemini (in particular,
daisy_help and daisy_liist). While we are generally against using LLMs for
code, the added functionality of being able to easily update information for
individual tools is useful and not considered to be vital functionality.
## How to use
Simply open your shell's RC-file (.bashrc, .zshrc, etc) and include `source <la
ckadaisical-folder>/daisy.source`, preferably at the bottom of the file. We recommend setting your editor before sourcing `lackadaisical`. For instance, putting `export EDITOR=/usr/bin/nano` near the top of your RC-file. It may later be overridden by `lackadaisical` itself if you use (or have used) `ched`.
Simply open your shell's RC-file (.bashrc, .zshrc, etc) and include
`source <lackadaisical-folder>/ld.source`, preferably at the bottom of the file.
We recommend setting your editor before sourcing `lackadaisical`. For instance,
putting `export EDITOR=/usr/bin/nano` near the top of your RC-file. It may
later be overridden by `lackadaisical` itself if you use (or have used) `ched`.
You can also try out the utilities by simply sourcing the file while running your shell of choice. It will automatically include itself into your `PATH` variable.
You can also try out the utilities by simply sourcing the file while running
your shell of choice. It will automatically include itself into your `PATH`
variable.
At first use, `lackadaisical` will provide you with information via `daisy_help`. This information is identical to what can be read in the `Getting Started` section below.
At first use, `lackadaisical` will provide you with some information. This
information is identical to what can be read in the `Getting Started` section
below.
Please use `daisy help` to see this message again if you get lost!
## Getting started
```
@ -30,6 +42,10 @@ specifying an env value of; NO_ARCHIVEMOUNT=1. The standard script supports
zip, tarballs, and rar archives. We recommend relying on archivemount` if you
have it installed. Use "--check" to only check if a file is an archive. It
returns 0 if it is, 1 otherwise.
Usage: cdz <archive>
cdz --check <archive>
Returns: (with --check) 0 if file is archive, 1 if it is not.
················································································
< squasher >
@ -58,6 +74,9 @@ take the same folder argument:
Uses your standard CLI editor to create/modify a file and make it executable.
If the executable already exists in path, it will edit that instead.
Should you not want this behavior, call the utility with the -n switch.
Usage: editx <file_local_or_in_path>
editx -n <file>
················································································
< filewait >
@ -66,6 +85,9 @@ This tool is given a filename of a file that does not exist yet. When the file
appears on disk, the tool quits and simply returns the filename. This can be
used in personal workflows to stall a longer command that relies on the
existence of said file.
Usage: filewait <inexistant_file>
Returns: filename specified as argument
················································································
< agenda >
@ -78,6 +100,21 @@ automatically cleans up empty folders. A symbolic link to the base of the
folder's tree, ".tree", is created in the root of the specified directly. Can
be used for everything you'd like to sort by date. For example; a diary,
browser downloads, backups, code.
There is a switch available:
--view <date>: Lists all entries recursively. For example, if used with a year
like "agenda --view "2026" <folder>", you will get a full
directory listing of all entries in 2026 recursively.
If you specify a month as well, you get all the entries from
said month. You can also select a specific date, but it it does
not exist, you will not get any results. Additionally, you need
to use the date structure YYYY/MM/DD.
Each day will be listed with a full path, allowing you to cd to
them (hint: The ".tree" symlink in your folder also allows you
to browse the tree).
Usage: agenda <folder>
agenda --view <folder>
················································································
< own >
@ -92,8 +129,12 @@ This is a wrapper for `ssh`, the meaning of the 'p' is "Plus". Integrates SSHFS
support. If both client and host have SSHFS, this wrapper can be used to
connect their file systems. For example, if you need to move files from one
machine to another, you could do something like this: "sshp -m /:/mnt/pc -m
/home/claire:/home/claire claire@pyon.net" If privilege escalation is necessary
for FS access, you will be asked for a password.
/home/claire:/home/claire claire@pyon.net". Each "-m" switch indicates a
Docker-style mapping from a local directory to a remote directory.
If privilege escalation is necessary for FS access, you will be asked for a
password.
Usage: sshp -m <local>:<remote> [user@]host [ssh_options]
················································································
< shrc >
@ -114,10 +155,15 @@ returns partial matches. It can be used to search for binaries.
················································································
< scriptbox >
················································································
························································q························
This tool can be used to pack bash scripts into one big megascript, much like
how `busybox` works. You can also make symlinks to it to invoke a specific
script.
script. Standard binaries are not supported.
Usage:
Creating boxed binary: scriptbox -o <BOXED_BIN> <-s source files>
<-p include files verbatim> -i INPUT_BINS ...
More information: scriptbox <no-args>
················································································
< bak/unbak >
@ -174,19 +220,24 @@ Similar to `cdf` but uses tree+peco for the query.
An extremely simple utility that functions as a clipboard of sorts. To set the
variable, run "clip <data>" or provide data via stdin. To get the variable,
simply run clip without any arguments. The variable is stored locally in the
shell as "LD_CLIP".
shell as "LD_CLIP". Run with switch "-c" to clear LD_CLIP.
Usage: clip <anystring>
clip -c
clip
Returns: Without arguments, the contents of LD_CLIP.
················································································
< ldrc >
················································································
Edits daisy.source and re-sources it, similarly to shrc. Append "-e" to edit
Edits ld.source and re-sources it, similarly to shrc. Append "-e" to edit
"extra.src", to add custom functions in the lackadaisical namespace.
Append "-d" to edit "daisy.command.source".
················································································
< daisy reload >
················································································
Re-sources daisy.source. Essentially `ldrc` without editing.
Re-sources ld.source. Essentially `ldrc` without editing.
················································································
< grab >
@ -288,3 +339,7 @@ functions provided by `lackadaisical`.
················································································
<!-- --- END OF DAISY HELP --- -->
```
# Future plans
We will keep improving and enhancing the scripts. Possibly, we will add new
utilities. We hope you found LACKADAISICAL useful.

93
agenda
View file

@ -1,39 +1,15 @@
#!/usr/bin/env bash
# This script is intended to be run via cron.
# This script is intended to be run via cron. But you can run it manually as
# well
# It creates a folder structure in home for the current date in the following format:
# $HOME/<Tag>/<Year>/<Month>/<Day>
# <Dir>/<Tag>/<Year>/<Month>/<Day>
# It also sets up a symlink for the tagged folder.
# This symlink will always point to the folder for the current date.
# Finally, it removes any folders without data, to prevent clutter.
LD_INTERNAL=1
. $(dirname $(realpath $0))/daisy.source
if [[ $1 == '' ]]; then
echo "Usage: $LD_BIN <folder>"
echo "Creates a folder within '.daisy' in the current directory containing"
echo "a tree of dates associated with the folder name given by argument."
echo "A symlink is (re-)created at the same time with the same folder name."
echo "For example, if given the folder 'notes', this utility will:"
echo "- Create a folder '/.daisy/notes/<year>/<month>/<day>'."
echo "- Create a symlink named 'notes' that points to it."
echo "It is recommended to run this via cron."
exit 1
fi
dir=$(realpath -s "$1")
parent_dir=$(dirname "$dir")
name=$(basename "$dir")
root_dir="$parent_dir/.daisy/$name"
today_sym="$dir"
# Present day
read year month day < <(date "+%Y %m %d")
today="$root_dir/$year/$month/$day"
set -e
function errorFn
@ -50,11 +26,70 @@ function errorFn
# Error handling
trap errorFn ERR
# Source LD
LD_INTERNAL=1
. $(dirname $(realpath $0))/ld.source
if [[ $1 == '' ]]; then
echo "Usage: $LD_BIN <folder>"
echo "Creates a folder within '.daisy' in the current directory containing"
echo "a tree of dates associated with the folder name given by argument."
echo "A symlink is (re-)created at the same time with the same folder name."
echo "For example, if given the folder 'notes', this utility will:"
echo "- Create a folder '/.daisy/notes/<year>/<month>/<day>'."
echo "- Create a symlink named 'notes' that points to it."
echo "It is recommended to run this via cron."
exit 1
fi
view=0
view_date=0
if [[ "$1" == "--view" ]]; then
# We are only going to view the agenda
view_date=$2
view=1
shift 2
fi
dir=$(realpath -s "$1")
parent_dir=$(dirname "$dir")
name=$(basename "$dir")
root_dir="$parent_dir/.daisy/$name"
today_sym="$dir"
# Present day
read year month day < <(date "+%Y %m %d")
today="$root_dir/$year/$month/$day"
# First we clear out empty folders, and remove the symlink if it exists
test -e "$root_dir" && find "$root_dir" -maxdepth 3 -type d -empty -delete
if test -e "$root_dir"; then
find "$root_dir" -name "More..." -delete
find "$root_dir" -depth -maxdepth 3 -type d \
-not -path "$today" \
-exec sh -c '
if [ $(ls -A "$1" | wc -l) -eq 0 ]; then
rm -rf "$1"
fi
' _ {} \;
fi
if [[ $view == 1 ]]; then
# View mode
[[ ! -d "$root_dir/$view_date" ]] && echo "This date entry does not exist." && exit 1
view_date="$root_dir/$view_date"
# 1. -name "*.squashfs" -prune: If a folder ends in .squashfs, don't descend into it.
# 2. ! -name "*.squashfs": Inside the directory check, ignore squashfs files.
# 3. --ignore="*.squashfs": Tells ls to hide those entries from the final list.
find "$(realpath "$view_date")" -name "*.squashfs" -prune -o -type d -exec sh -c '
find "$1" -maxdepth 1 -type f ! -name "*.squashfs" | read -r
' _ {} \; -exec ls --color=always -lah --ignore="*.squashfs" {} + 2>/dev/null
exit 0
fi
# Now we can set up today's directory
mkdir -p "$today"
ln -snf "$today" "$today_sym"
ln -snf "$root_dir" "$dir/.tree"
ln -snf "$root_dir" "$dir/More..."
exitcode=$?

5
cdz
View file

@ -4,7 +4,7 @@
if [[ $LD_INTERNAL -ne 1 ]]
then
LD_INTERNAL=1
. $(dirname $(realpath $0))/daisy.source
. $(dirname $(realpath $0))/ld.source
fi
is_archive()
@ -12,7 +12,8 @@ is_archive()
local file="$1"
local mime_type=$(file --mime-type -b "$file")
if [[ $mime_type == *"tar"* || $file == *.tar* || $mime_type == "application/zip" || $mime_type == "application/x-rar" ]]
if [[ $mime_type == *"tar"* || $file == *.tar* || \
$mime_type == "application/zip" || $mime_type == "application/x-rar" ]]
then
return 0
fi

View file

@ -40,17 +40,20 @@ _daisy_enc()
fi
if [ -n "$1" ] && [ -d "$1" ]; then
echo -e "daisy_create_folder=$1"
printf "daisy_create_folder=%s\n" "$1"
else
local file_dir=""
local file_dir="."
local file_name=""
local perms=755
local input_source="/dev/stdin"
local target=$1
if [[ ! -t 0 ]] && [[ $enc_is_folder == 0 ]]; then
input_source="$1"
file_dir="."
file_name="$1"
elif [ -f "$1" ]; then
input_source="$1"
file_dir=$(dirname "$1")
file_name=$(basename "$1")
perms=$(stat -c %a "$1")
@ -60,10 +63,10 @@ _daisy_enc()
fi
local base64_inner
base64_inner=$(cat "${1:-/dev/stdin}" | base64 | tr -d '\n')
echo -e "daisy_folder_$file_name=$file_dir"
echo -e "daisy_data_base64_$file_name=\"$base64_inner\""
echo -e "daisy_perms_$file_name=$perms"
base64_inner=$(cat "${input_source:-/dev/stdin}" | base64 | tr -d '\n')
printf "daisy_folder_%s=%s\n" "$file_name" "$file_dir"
printf "daisy_data_base64_%s=\"%s\"\n" "$file_name" "$base64_inner"
printf "daisy_perms_%s=%s\n" "$file_name" "$perms"
fi
}
@ -73,16 +76,15 @@ _daisy_dec()
echo "$0: No arguments or stdin specified!"
return 1
fi
local data
data=$(cat "${1:-/dev/stdin}" | grep -v "#")
echo -e "$data" | cut -d "=" -f 2- | cut -b 2- | head -c -2 | base64 -d
sed -n "s/^daisy_data_base64_.*=\"\(.*\)\"$/\1/p" "${1:-/dev/stdin}" | base64 -d
}
_daisy_unalias()
{
local unalias_param="$1"
if [[ $unalias_param =~ ^[0-9]+$ ]]; then
unalias_param=$(head -"$unalias_param" "$LD_ALIASFILE" 2>/dev/null | tail -1 | cut -d "=" -f 1 | awk '{print $2}')
unalias_param=$(head -"$unalias_param" "$LD_ALIASFILE" 2>/dev/null | \
tail -1 | cut -d "=" -f 1 | awk '{print $2}')
fi
if [[ -z "$unalias_param" ]]; then
return
@ -117,49 +119,49 @@ cmd_help()
# Match lines defining tools (e.g., "< cdz >" or "< daisy welcome >")
$0 ~ /^[[:space:]]*< .* >/ {
printing=0 # Stop printing previous tool
printing=0 # Stop printing previous tool
# Clean the line to get the "signature"
# "< daisy welcome >" becomes "daisy welcome"
sig = $0
sub(/^[[:space:]]*< /, "", sig)
sub(/ >[[:space:]]*$/, "", sig)
# Clean the line to get the "signature"
# "< daisy welcome >" becomes "daisy welcome"
sig = $0
sub(/^[[:space:]]*< /, "", sig)
sub(/ >[[:space:]]*$/, "", sig)
# Check for exact match OR match within a slash/space-separated list
split(sig, names, "[ /]")
# Check for exact match OR match within a slash/space-separated list
split(sig, names, "[ /]")
is_match = 0
if (sig == query) is_match = 1
else {
for (i in names)
{
if (names[i] == query)
{ is_match = 1; break }
}
}
is_match = 0
if (sig == query) is_match = 1
else {
for (i in names)
{
if (names[i] == query)
{ is_match = 1; break }
}
}
if (is_match)
{
printing=1
found=1
print $0
next
}
if (is_match)
{
printing=1
found=1
print $0
next
}
}
# Print description lines if we are in a "found" block
printing {
# Stop if we hit the start of the NEXT tool
if ($0 ~ /^[[:space:]]*< /)
{ printing=0; next }
print
# Stop if we hit the start of the NEXT tool
if ($0 ~ /^[[:space:]]*< /)
{ printing=0; next }
print
}
END {
if (found == 0)
{
print "Tool '"'"'" query "'"'"' not found in README.md."
}
if (found == 0)
{
print "Tool '"'"'" query "'"'"' not found in README.md."
}
}
'
fi
@ -176,9 +178,9 @@ cmd_list()
sed -n '/--- BEGIN OF DAISY HELP ---/,/--- END OF DAISY HELP ---/{//!p;}' "$file" |
awk '
/^[[:space:]]*< / {
sub(/^[[:space:]]*< /, "");
sub(/ >[[:space:]]*$/, "");
print " " $0
sub(/^[[:space:]]*< /, "");
sub(/ >[[:space:]]*$/, "");
print " " $0
}
' | sort
}
@ -220,8 +222,8 @@ cmd_dec()
local arg1=$1
local arg2=$2
if [ ! -t 0 ]; then
arg2=$1
arg1=/dev/stdin
arg2=$1
arg1=/dev/stdin
fi
[[ -t 0 ]] && [[ ! -f "$arg1" ]] && echo "daisy dec multi: No input file specified" && exit 1
[[ ! -d "$arg2" ]] && echo "daisy dec multi: No output directory specified" && exit 1
@ -258,9 +260,9 @@ cmd_alias()
local linenum=1
if [[ -f "$LD_ALIASFILE" ]]; then
while IFS= read -r line; do
line=$(echo "$line" | sed 's/alias //g')
echo "$linenum: $line"
((linenum++))
line=$(echo "$line" | sed 's/alias //g')
echo "$linenum: $line"
((linenum++))
done < "$LD_ALIASFILE"
fi
else
@ -321,7 +323,7 @@ cmd_check()
check_bin sed "Stream editing"
check_bin grep "Pattern matching"
check_bin base64 "Data encoding"
check_bin realpath "Path resolution"
check_bin realpath "Path resolution"
echo -e "\n--- Enhanced UI & Navigation ---"
check_bin fzf "Used by cdf"
@ -398,9 +400,13 @@ daisy ()
dec) shift; cmd_dec "$@" ;;
alias) shift; cmd_alias "$@" ;;
unalias) shift; _daisy_unalias "$@" ;;
backup) shift; find "$LD_CONFIG_FOLDER" -name "*.src" -type f | while read -r f; do cp -R "$f" "$f.bak"; echo "Backup made: $f --> $f.bak"; done ;;
backup) shift; find "$LD_CONFIG_FOLDER" -name "*.src" -type f | \
while read -r f; do \
cp -R "$f" "$f.bak"; \
echo "Backup made: $f --> $f.bak";
done ;;
clear) shift; cmd_clear ;;
check) shift; cmd_check ;;
check) shift; cmd_check ;;
restore) shift; cmd_restore ;;
combine) shift; cmd_combine ;;
editor) shift; cmd_editor "$@" ;;

24
editx
View file

@ -3,7 +3,13 @@
# removes the resulting file if it is empty after the editor closes.
LD_INTERNAL=1
. $(dirname $(realpath $0))/daisy.source
. $(dirname $(realpath $0))/ld.source
use_path=1
if [[ $1 == "-n" ]]; then
shift
use_path=0
fi
if [[ -z $1 ]];
then
@ -13,7 +19,7 @@ fi
if [[ -z "${EDITOR}" ]];
then
# ched is defined in daisy.source
# ched is defined in ld.source
ched "EDITOR env variable not set! You will have to set it yourself in the next screen."
fi
@ -23,7 +29,7 @@ file_in_path=$(whereis $1 | awk '{print $2}')
path_exist=0
[[ -e "$file" ]] && file_exist=1
[[ -n "$file_in_path" ]] && path_exist=1
[[ $use_path == 1 ]] && [[ -n "$file_in_path" ]] && path_exist=1
if [[ $path_exist == 1 && $file_exist == 0 ]]; then
file=$file_in_path
@ -37,14 +43,14 @@ elif [[ $path_exist == 1 && $file_exist == 1 ]]; then
case "$choice" in
1)
file=$file
;;
file=$file
;;
2|"")
file="$file_in_path"
;;
file="$file_in_path"
;;
*)
file="$file_in_path"
;;
file="$file_in_path"
;;
esac
fi
fi

View file

@ -2,7 +2,7 @@
# A simple utility that waits for a file to become available, infinitely
LD_INTERNAL=1
. $(dirname $(realpath $0))/daisy.source
. $(dirname $(realpath $0))/ld.source
file=$@
while [ ! -f "$file" ]

View file

@ -5,7 +5,7 @@
# Source this in your RC file or manually to receive some of the simpler
# utilities, as well as aliases for `shrc` and `cdf`. Set env variable
# FROM_RC to 1 when sourcing this file to get RC-related functionality:
# FROM_RC=1 source <lackadaisical-root>/daisy.source
# FROM_RC=1 source <lackadaisical-root>/ld.source
# This file is also sourced in some of the scripts included within
# lackadaisical for common functionality. Some of the shared functionality is
@ -30,7 +30,7 @@ function ld_dbg
# Variables for use in other utilities
# Find the right argument for our folder
arg=$0
if [[ ! $arg == *daisy.source* ]];
if [[ ! $arg == *ld.source* ]];
then
arg="${BASH_SOURCE[0]}"
fi
@ -78,17 +78,20 @@ fi
export LD_ALIASFILE="$LD_CONFIG_FOLDER/aliases.src"
export LD_EDITORFILE="$LD_CONFIG_FOLDER/editor.src"
export LD_ESOURCEFILE="$LD_CONFIG_FOLDER/extra.src"
export LD_SHORTFILE="$LD_CONFIG_FOLDER/short.src"
touch $LD_ALIASFILE
touch $LD_EDITORFILE
touch $LD_ESOURCEFILE
touch $LD_ESOURCEFILE
touch $LD_SHORTFILE
ld_dbg echo "Sourced config contents:"
ld_dbg cat $LD_ALIASFILE
ld_dbg cat $LD_EDITORFILE
ld_dbg cat $LD_ESOURCEFILE
ld_dbg cat $LD_SHORTFILE
# Source everything in the config folder
function _daisy_source_configs
function _ld.source_configs
{
while IFS= read -r -d '' f; do
source "$f"
@ -231,7 +234,7 @@ function ched
fi
editors=("nano" "vim" "nvim" "vi" "emacs" "gedit" "kate" "mousepad" "micro" \
"code" "subl" "joe" "kwrite" "gnome-text-editor")
"code" "subl" "joe" "kwrite" "gnome-text-editor")
# Find which editors are installed
available_editors=()
@ -242,12 +245,12 @@ function ched
then
if [[ $(realpath "$EDITOR") == "$editor_real" ]];
then
available_editors+=("$editor_real" "$editor (current)")
available_editors+=("$editor_real" "$editor (current)")
elif [[ $LD_EDITOR == "$editor_real" ]];
then
available_editors+=("$editor_real" "$editor (LD choice)")
available_editors+=("$editor_real" "$editor (LD choice)")
else
available_editors+=("$editor_real" "$editor")
available_editors+=("$editor_real" "$editor")
fi
fi
done
@ -264,8 +267,8 @@ function ched
# Present all choices
choice=$(dialog --output-fd 1 --clear --title "Select Text Editor" \
--menu "Choose one of the installed text editors:" 15 100 6 \
"${available_editors[@]}")
--menu "Choose one of the installed text editors:" 15 100 6 \
"${available_editors[@]}")
dialog_ret=$?
if [ $dialog_ret -ne 0 ];
@ -301,6 +304,12 @@ function grab
function clip
{
if [[ $1 == "-c" ]]; then
echo Clipboard cleared.
LD_CLIP=""
return 0
fi
data=""
if [ ! -t 0 ]; then
@ -342,7 +351,7 @@ _daisy_def_alias help
_daisy_def_alias list
_daisy_def_alias check
_daisy_source_configs
_ld.source_configs
###############################################################################
# check for dependencies @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

2
own
View file

@ -3,7 +3,7 @@
# user, recursively.
LD_INTERNAL=1
. $(dirname $(realpath $0))/daisy.source
. $(dirname $(realpath $0))/ld.source
if [[ -z "$1" ]]; then
echo "$LD_BIN: Quickly take ownership of files/folders."

View file

@ -4,7 +4,7 @@
# said script. The idea is similar to `busybox`.
LD_INTERNAL=1
. $(dirname $(realpath $0))/daisy.source
. $(dirname $(realpath $0))/ld.source
args=$@
@ -16,9 +16,9 @@ function help()
echo "call the function like so: 'combi-bin input-bin <input-bin args>."
echo ""
echo "> Usage:"
echo "Creating boxed binary: $LD_BIN -o <BOXED_BIN> <-s source files> <-p include files verbatim> -i INPUT_BINS ..."
echo "<X> Unpacking a boxed binary: $LD_BIN -e <BOXED_BIN>"
echo "View this screen: $LD_BIN <noargs>"
echo "Boxing scripts: scriptbox -o <BOXED_BIN> <-s source files>"
echo " <-p include files verbatim> -i INPUT_BINS ..."
echo "View help: $LD_BIN <noargs>"
exit 0
}
@ -63,45 +63,45 @@ while [ $i -lt $# ]; do
-i)
((i++))
while [ $i -lt $# ] && [[ ! "${args[$i]}" =~ ^- ]]; do
file="${args[$i]}"
((i++))
if [[ -e "$file" ]]; then
inputs+=("$file")
((b++))
else
echo "WARNING: Missing input binary: \"$file\"."
echo "Module will NOT be available!"
fi
file="${args[$i]}"
((i++))
if [[ -e "$file" ]]; then
inputs+=("$file")
((b++))
else
echo "WARNING: Missing input binary: \"$file\"."
echo "Module will NOT be available!"
fi
done
continue
;;
-s)
((i++))
while [ $i -lt $# ] && [[ ! "${args[$i]}" =~ ^- ]]; do
file="${args[$i]}"
((i++))
if [[ -e "$file" ]]; then
sources+=("$file")
((s++))
else
echo "WARNING: Missing input source: \"$file\"."
echo "File will NOT be sourced!"
fi
file="${args[$i]}"
((i++))
if [[ -e "$file" ]]; then
sources+=("$file")
((s++))
else
echo "WARNING: Missing input source: \"$file\"."
echo "File will NOT be sourced!"
fi
done
continue
;;
-p)
((i++))
while [ $i -lt $# ] && [[ ! "${args[$i]}" =~ ^- ]]; do
file="${args[$i]}"
((i++))
if [[ -e "$file" ]]; then
includes+=("$file")
((p++))
else
echo "WARNING: Missing input include: \"$file\"."
echo "File will NOT be included!"
fi
file="${args[$i]}"
((i++))
if [[ -e "$file" ]]; then
includes+=("$file")
((p++))
else
echo "WARNING: Missing input include: \"$file\"."
echo "File will NOT be included!"
fi
done
continue
;;

View file

@ -147,8 +147,8 @@ case "$COMMAND" in
destroy)
if [[ ! -f "$DIR/.needs_mount" ]]; then
if ! mountpoint -q "$DIR"; then
echo "Error: $DIR is not a SquashFS directory."
exit 1
echo "Error: $DIR is not a SquashFS directory."
exit 1
fi
fi

26
sshp
View file

@ -13,16 +13,18 @@ usage()
}
while [[ $# -gt 0 ]]; do
case "$1" in
-m)
if [[ -z "$2" ]]; then echo "Error: -m requires argument"; exit 1; fi
mounts+=("$2")
shift 2
;;
*)
ssh_args+=("$1")
shift
;;
case "$1" in
-m)
if [[ -z "$2" ]]; then
echo "Error: -m requires argument"; exit 1;
fi
mounts+=("$2")
shift 2
;;
*)
ssh_args+=("$1")
shift
;;
esac
done
@ -48,9 +50,9 @@ done
remote_script="
if ! command -v sshfs >/dev/null 2>&1; then
echo 'WARNING: \"sshfs\" not found on remote host.'
echo 'WARNING: \"sshfs\" not found on remote host.'
else
${mount_logic}
${mount_logic}
fi
\${SHELL:-bash};
${unmount_logic}

2
sw
View file

@ -2,7 +2,7 @@
# It just swaps two files
LD_INTERNAL1
. $(dirname $(realpath $0))/daisy.source
. $(dirname $(realpath $0))/ld.source
file1=$1
file2=$2

2
what
View file

@ -24,7 +24,7 @@
#
LD_INTERNAL=1
. $(dirname $(realpath $0))/daisy.source
. $(dirname $(realpath $0))/ld.source
all_bins=$(compgen -c | sort -u)