Browse Source

a l r i g h t

Added a workaround for a certain file host on minpb , the -r switch is now -t , and added long switches
config.mk and Makefile were entirely rewritten.
main
Nova[有線魔女] 2 months ago
parent
commit
9167e76b61
  1. 17
      Makefile
  2. 11
      config.mk
  3. 27
      minpb

17
Makefile

@ -1,16 +1,7 @@
include config.mk
OBJS=desktop-file-generator \
ipcheck \
linx \
minpb \
nofetch \
system-backup \
termbin \
weather
install:
for obj in ${OBJS}; do cp -f ${OBJS} $(DESTDIR)$(PREFIX)/bin/;done
for obj in ${OBJS}; do chmod 0755 $(DESTDIR)$(PREFIX)/bin/$$obj; done
for i in ${STUFF}; do \
install -m0755 $$i $(DESTDIR)$(PREFIX)/bin/$$i; done
uninstall:
for obj in ${OBJS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$obj;done
for i in ${STUFF}; do \
rm -f -v $(DESTDIR)$(PREFIX)/bin/$$i; done

11
config.mk

@ -1,6 +1,11 @@
PREFIX ?= /usr/local
EPREFIX = ${PREFIX}/bin
DESTDIR ?=
OBJS = "adblock \
STUFF = desktop-file-generator \
ipcheck \
linx \
minpb \
nofetch \
system-backup \
termbin \
weather

27
minpb

@ -3,32 +3,35 @@
# extremely simple script written in posix sh
# uses curl as backend, therefore it depends on it to work.
# license : gplv3
paste() {
printf "$2" | curl -F"file=@-" "$3" || die "Something unexpected did happen"
printf "$2" | curl -F"file=@-" "$3" || die "Something unexpected did happen."
}
posturl() {
curl -F "url=$2" "$3"
}
shorten() {
if [ "$3" = "https://i.kalli.st" ];then
curl -sF "url=$2" "$3" || die "Something unexpected did happen"
curl -sF "url=$2" "$3" || die "Something unexpected did happen."
else
curl -sF "shorten=$2" "$3" || die "Something unexpected did happen"
curl -sF "shorten=$2" "$3" || die "Something unexpected did happen."
fi
}
upload() {
curl -F"file=@$2" "$3" || die "Something unexpected did happen."
if [ "$3" = "https://cockfile.com/upload.php" ];then
curl -i -F files[]=@$2 "$3" || die "Something unexpected did happen."
else
curl -F"file=@$2" "$3" || die "Something unexpected did happen."
fi
}
usage() {
printf "[ $0 - v2021.08.14 ] \n"
printf "[ $0 - v2021.08.22 ] \n"
printf "Mini version of tomasino's pb tool \n"
printf "================================== \n"
printf "Available switches are : \n"
printf "\t -p <text> <endpoint>\t<~~~~~~~>\tPastebin mode\n"
printf "\t -r <url> <endpoint>\t<~~~~~~~>\tPOST URLs to endpoint\n"
printf "\t -t <url> <endpoint>\t<~~~~~~~>\tPOST URLs to endpoint\n"
printf "\t -s <url> <endpoint>\t<~~~~~~~>\tShorten links\n"
printf "\t -u <file> <endpoint>\t<~~~~~~~>\tUpload files \n"
printf "\n"
@ -40,19 +43,19 @@ die() {
}
case $1 in
-p)
-p | --paste)
paste "$@"
;;
-r)
-t | --post-url)
posturl "$@"
;;
-s)
-s | --shorten)
shorten "$@"
;;
-u)
-u | --upload)
upload "$@"
;;
-h)
-h | --help)
usage
;;
*)

Loading…
Cancel
Save