-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleantorrent.Slackonfig.sh
executable file
·137 lines (129 loc) · 5.41 KB
/
cleantorrent.Slackonfig.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
#
##
###
##################################################################################
# #
# Copyright 2018; Antonio Henrique (Fela); <ahlr_2000@yahoo.com> #
# #
# #
# #
# Redistribution and use of this script, with or without modification, is #
# permitted provided that the following conditions are met: #
# #
# 1. Redistributions of this script must retain the above copyright #
# notice, this list of conditions and the following disclaimer. #
# #
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED #
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO #
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, #
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; #
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, #
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR #
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF #
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
##################################################################################
# #
# Repositry: #
# github.com/ahlrodrigues/slackonfig #
# bitbucket.org/ahlrodrigues/slackonfig #
# #
# Bugs, Thanks, "Constructive" reviews! #
# Send me an email, I'll be very grateful! #
# #
##################################################################################
# #
# This scripts is a free softwares, you can redistribute it and/or modifies it #
# within the terms of the GNU General Public License. #
# #
# GNU General Public License: #
# [GPL](https://en.wikipedia.org/wiki/GNU_General_Public_License) #
# Fundação do Software Livre (FSF) Inc. 51 Franklin St, Fifth Floor, #
# Boston, MA 02110-1301 USA #
# #
##################################################################################
###
##
#
# --------- Efeito nas Cores --------- #
#0 Normal Characters
#1 Bold Characters
#4 Underlined Characters
#5 Blinking Characters
#7 Reverse video Characters
# --------- Cores --------- #
BLACK='\e[1;30m'
BBLACK='\e[5;30m'
RED='\e[1;31m'
BRED='\e[5;31m' # bink color
GREEN='\e[1;32m'
BGREEN='\e[1;32m'
BROWN='\e[1;33m'
BBROWN='\e[5;33m'
BLUE='\e[1;34m'
BBLUE='\e[5;34m'
PINK='\e[1;35m'
BPINK='\e[5;35m'
CYAN='\e[1;36m'
BCYAN='\e[5;36m'
WHITE='\e[1;37m'
BWHITE='\e[5;37m'
NC='\033[0m' # reset/no color
#
##
###
# --------- Variáveis fixas --------- #
rawdocs=https://raw.githubusercontent.com/ahlrodrigues/slackonfig/master/docs
minilicense=/tmp/minilicense.txt
permix="chmod +x"
permi0="chmod 644"
rcd=/etc/rc.d
# --------- Baixando arquivos auxiliares no diretório /tmp --------- #
if [ ! -f "$minilicense" ]; then
wget -q -nv -e robots=0 -r -nd -cP /tmp \
$rawdocs/minilicense.txt
fi
# --------- Checando permissão - INÍCIO --------- #
if [[ $(whoami) == "root" ]]; then
# --------- Criando script - CABEÇALHO --------- #
name=/usr/local/bin/cleantorrent.sh
echo "#!"$SHELL > $name
cat $minilicense >> $name
echo "#" >> $name
echo "##" >> $name
echo "###" >> $name
echo "#####" >> $name
echo "" >> $name
# --------- Criando script - INÍCIO --------- #
#Criação do arquivo cleanlog.sh
echo "#!"$SHELL > $name
cat $minilicense >> $name
echo "LOCATION="/home/ahlr/Downloads"" >> $name
echo 'for FILE in $LOCATION/*; do ' >> $name
echo ' if [[ $FILE == *.torrent ]]; then ' >> $name
echo ' #echo "$FILE" ' >> $name
echo ' rm "$FILE" ' >> $name
echo " fi " >> $name
echo "done " >> $name
echo "" >> $name
$permix $name
$permi0 $name
echo "" >> $name
echo "#####" >> $name
echo "###" >> $name
echo "##" >> $name
echo "#" >> $name
echo
echo -e "$WHITE $name $GREEN criado com sucesso! $NC"
echo
# --------- Aviso --------- #
else
echo
echo
echo -e "$BRED Logue-se como ROOT! $NC"
echo
echo
fi