add license, fix gitlab ci, new installation method

dev
Volkor The Barbarian Warrior 2018-09-28 22:43:39 +10:00
parent 97e90ca385
commit 6f13ea7915
No known key found for this signature in database
GPG Key ID: E94E60706F9796F7
6 changed files with 35 additions and 59 deletions

View File

@ -9,6 +9,9 @@ test:
image: alpine:latest
tags:
- docker
cache:
paths:
- binaries/*.apk
script:
- apk update && apk add curl libnotify bash jq
- bash

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Volkor The Barbarian Warrior
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

8
Makefile Normal file
View File

@ -0,0 +1,8 @@
install:
type curl && type jq || exit 1
mkdir -p $(DESTDIR)/usr/bin
install -m 0755 supload.sh $(DESTDIR)/usr/local/bin/supload
install -m 0755 supload.conf $(DESTDIR)/etc/supload.conf
uninstall:
rm $(DESTDIR)/usr/bin/supload

View File

@ -9,19 +9,8 @@ To install this, you can follow the commands below:
```bash
git clone https://gitlab.com/Volkor/supload.git
cd curl-uploader
chmod +x install.sh
./install.sh
```
If you install supload to anything but the default (conflicting filenames), mentally replace `supload` with whatever you named it if you spot it in the documentation
if the install.sh fails (report the actual issue), and copy the files manually as a workaround with:
```bash
sudo cp upload.sh /usr/bin/upload
sudo cp screenshot.sh /usr/bin/screenshot
sudo chmod +x /usr/bin/screenshot /usr/bin/upload
cd SUpload
sudo make install
```
## Dependencies

View File

@ -1,44 +0,0 @@
#!/bin/bash
r=$(tput smso)
b=$(tput bold)
n=$(tput sgr0)
red=$(tput setaf 1)
check_dep() {
type $@ >/dev/null 2>&1 || { echo >&2 "I require "$@" but it's not installed. Aborting."; exit 1; }
}
check_opt() {
type $@ >/dev/null 2>&1 || { echo >&2 "I recommend you install "$@" for full functionality"; }
}
install() {
if sudo ln -s $PWD/supload.sh /usr/bin/supload ; then
echo "Installation Successful, You can now use the command 'supload'!'"
exit 0
else
while true; do # Fixing menu
options=("${r}D${n}elete the current file at /usr/bin/supload and reinstall (Not recommended)" \
"${r}U${n}se an alternative name for SUpload (Recommended)" \
"${r}E${n}xit and give up like a little baby.")
PS3="${red}Failed to create symbolic link.${n} Enter an option [1,2,3/D,U,E]"
select opt in "${options[@]}"
do
case $REPLY in
1 | [Dd]*) sudo rm /usr/bin/supload; install ;;
2 | [Uu]*) read -p "What name would you want to use (cumload, upload, cumzone, supload)" newname; sudo ln -s $PWD/supload.sh /usr/bin/$newname; echo "Installation Successful, You can now use the command '"$newname"'!"; exit ;;
3 | [Ee]*) echo "you baby"; exit ;;
*) echo "Invalid Option!" ;;
esac
done
done
fi
}
clear
check_dep curl
check_dep jq
check_opt scrot
check_opt xclip
check_opt notify-send
install

View File

@ -68,8 +68,7 @@ upload_file() {
response=$(curl $CURL_OPTIONS -F file=@"$1" "$BASE_URL") || { echo -e >&2 "${R}ERROR:${NC} Curl upload failure. (Invalid file, or bad internet connection)"; exit 1; }
$DEBUG && echo -e "${R}DEBUG:${NC} RESPONSE: $response"
file=$(echo $response | jq -r '.["file"]')
url="$BASE_URL$file"
url=$(echo $response | jq -r '.["url"]')
deletionlink=$(echo $response | jq -r '.["deletionurl"]')
$DEBUG && echo -e "${R}DEBUG:${NC} URL: $url"