Improve scripts

This commit is contained in:
Tobias Reisinger 2021-07-10 00:50:17 +02:00
parent 942e2d84cf
commit 66415e7de9
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 44 additions and 18 deletions

View file

@ -1,5 +1,13 @@
#!/usr/bin/sh
alias get_priv="sudo"
if [ -x "$(command -v doas)" ]
then
alias get_priv="doas"
fi
get_priv echo
paru -Syu
if [ $? -eq 0 ]; then
@ -13,12 +21,7 @@ fi
echo "==================================================================="
if [ -x "$(command -v doas)" ]
then
doas checkservices
else
sudo checkservices
fi
get_priv checkservices
if [ $? -eq 0 ]; then
echo "CHECKSERVICES SUCCEDEED"

View file

@ -1,5 +1,7 @@
#!/usr/bin/sh
set -e
priv_cmd="sudo"
if [ -x "$(command -v doas)" ]

View file

@ -3,26 +3,45 @@
s3_bucket=public.serguzim.me/screenshots
s3_host=https://sos-de-fra-1.exo.io
path=/tmp/screenshot.png
process_image()
{
file=$(date "+%F_%H-%M-%S").png
clip_image()
{
xclip -t image/png $1 -selection clipboard
}
s3cmd put -P $1 s3://$s3_bucket/$file
upload_image()
{
echo -n "$s3_host/$s3_bucket/$file" | xclip -selection primary
s3cmd put -P $1 s3://$s3_bucket/$file
notify-send -a "Screenshot" "Uploaded screenshot to s3"
}
main_no_upload()
{
if flameshot gui -r > $path
then
clip_image $path
fi
}
main()
{
if [ -n "$1" ] && [ -e "$1" ]
then
convert $1 $path
process_image $path
clip_image $path
upload_image $path
else
if flameshot gui -r > $path
then
process_image $path
clip_image $path
upload_image $path
fi
fi
}
case $1 in
no_upload) main_no_upload ;;
*) main $1 ;;
esac

View file

@ -27,3 +27,5 @@ then
Mopidy:out_jackaudiosink0_1 Speaker:playback_1 \
Mopidy:out_jackaudiosink0_2 Speaker:playback_2 &
fi
sleep 3