Skip to content

Commit f301c67

Browse files
author
htpcbeginner
committed
updates
1 parent e339906 commit f301c67

11 files changed

+348
-30
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
tmp/
2+
backups/

maintenance/clearbackups.sh

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
# Script Name: AtoMiC ToolKit Backups Cleaner
3+
# Author: htpcBeginner
4+
# Publisher: http://www.htpcBeginner.com
5+
# License: MIT License (refer to README.md for more details)
6+
#
7+
8+
# DO NOT EDIT ANYTHING UNLESS YOU KNOW WHAT YOU ARE DOING.
9+
10+
if [[ $1 != *"setup.sh"* ]]
11+
then
12+
echo
13+
echo -e '\e[91mCannot be run directly. Please run setup.sh from AtoMiC ToolKit root folder: \033[0msudo bash setup.sh'
14+
echo
15+
exit 0
16+
fi
17+
18+
source $2/inc/commons.sh
19+
source $SCRIPTPATH/inc/header.sh
20+
21+
echo -e $GREEN'AtoMiC ToolKit Backups Cleaner'$ENDCOLOR
22+
23+
echo
24+
25+
target=$SCRIPTPATH/backups/
26+
if find "$target" -mindepth 1 -print -quit | grep -q .; then
27+
echo -e $YELLOW'--->Below are the backups folder contents...'$ENDCOLOR
28+
ls -l $SCRIPTPATH/backups/*
29+
30+
echo
31+
sleep 1
32+
33+
echo -e $GREEN'Delete all backups?'$ENDCOLOR
34+
echo -e 'Triple check. You will not be able to restore if you delete backups.'
35+
read -p 'Type y/Y and press [ENTER] to delete or any other key to exit: '
36+
RESP=${REPLY,,}
37+
38+
echo
39+
40+
if [ "$RESP" == "y" ]
41+
then
42+
echo -e $YELLOW'--->Deleting all backups...'$ENDCOLOR
43+
rm $SCRIPTPATH/backups/* >/dev/null 2>&1
44+
if find "$target" -mindepth 1 -print -quit | grep -q .; then
45+
echo -e $RED'Deleting backups failed.'$ENDCOLOR
46+
else
47+
echo -e 'All backups deleted successfully.'
48+
fi
49+
else
50+
echo -e $RED'Backups not deleted.'$ENDCOLOR
51+
fi
52+
else
53+
echo -e $RED"There are no backups to delete."$ENDCOLOR
54+
fi
55+
56+
source $SCRIPTPATH/inc/exit.sh

maintenance/cleartmp.sh

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
# Script Name: AtoMiC ToolKit Temporary Data Cleaner
3+
# Author: htpcBeginner
4+
# Publisher: http://www.htpcBeginner.com
5+
# License: MIT License (refer to README.md for more details)
6+
#
7+
8+
# DO NOT EDIT ANYTHING UNLESS YOU KNOW WHAT YOU ARE DOING.
9+
10+
if [[ $1 != *"setup.sh"* ]]
11+
then
12+
echo
13+
echo -e '\e[91mCannot be run directly. Please run setup.sh from AtoMiC ToolKit root folder: \033[0msudo bash setup.sh'
14+
echo
15+
exit 0
16+
fi
17+
18+
source $2/inc/commons.sh
19+
source $SCRIPTPATH/inc/header.sh
20+
21+
echo -e $GREEN'AtoMiC ToolKit Temporary Data Cleaner'$ENDCOLOR
22+
23+
echo
24+
25+
target=$SCRIPTPATH/tmp/
26+
if find "$target" -mindepth 1 -print -quit | grep -q .; then
27+
echo -e $YELLOW'--->Below are the tmp folder contents...'$ENDCOLOR
28+
ls -l $SCRIPTPATH/tmp/*
29+
30+
echo
31+
sleep 1
32+
33+
echo -e $GREEN'Delete all temporary data?'$ENDCOLOR
34+
echo -e 'Temporary data can be safely deleted and recreated.'
35+
read -p 'Type y/Y and press [ENTER] to delete or any other key to exit: '
36+
RESP=${REPLY,,}
37+
38+
echo
39+
40+
if [ "$RESP" == "y" ]
41+
then
42+
echo -e $YELLOW'--->Deleting all temporary...'$ENDCOLOR
43+
rm $SCRIPTPATH/tmp/* >/dev/null 2>&1
44+
if find "$target" -mindepth 1 -print -quit | grep -q .; then
45+
echo -e $RED'Deleting temporary data failed.'$ENDCOLOR
46+
else
47+
echo -e 'All temporary data deleted successfully.'
48+
fi
49+
else
50+
echo -e $RED'Temporary data not deleted.'$ENDCOLOR
51+
fi
52+
else
53+
echo -e $RED"There are no temporary data to delete."$ENDCOLOR
54+
fi
55+
56+
source $SCRIPTPATH/inc/exit.sh
File renamed without changes.
File renamed without changes.

setup.sh

+23-16
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ if [ ! -d "$SCRIPTPATH/tmp" ]; then
3535
mkdir $SCRIPTPATH/tmp
3636
fi
3737

38+
if [ ! -d "$SCRIPTPATH/backups" ]; then
39+
mkdir $SCRIPTPATH/backups
40+
fi
41+
3842
echo -e $YELLOW'--->DISCLAIMERS:'$ENDCOLOR
3943
if [ ! -f "$SCRIPTPATH/tmp/consented" ]; then
4044
#echo 'consent file not present'
@@ -115,11 +119,14 @@ echo -e $YELLOW'56. '$ENDCOLOR'HTPC Manager - Uninstall'
115119
echo -e $YELLOW'60. '$ENDCOLOR'Plex Server - Install'
116120
echo -e $YELLOW'65. '$ENDCOLOR'Deluge - Install '$RED'(Broken)'$ENDCOLOR
117121
echo -e $YELLOW'70. '$ENDCOLOR'MusicBrainz - Install '$RED'(In Progress)'$ENDCOLOR
118-
echo -e $YELLOW'75. '$ENDCOLOR'Webmin - Install '$RED'(Update)'$ENDCOLOR
119-
echo -e $YELLOW'75. '$ENDCOLOR'Webmin - Uninstall '$RED'(Planned)'$ENDCOLOR
122+
echo -e $YELLOW'75. '$ENDCOLOR'Webmin - Install '$RED'(test)'$ENDCOLOR
123+
echo -e $YELLOW'76. '$ENDCOLOR'Webmin - Uninstall '$RED'(test)'$ENDCOLOR
124+
echo -e $YELLOW'77. '$ENDCOLOR'Webmin - Backup Settings '$RED'(Planned)'$ENDCOLOR
125+
echo -e $YELLOW'78. '$ENDCOLOR'Webmin - Restore Settings '$RED'(Planned)'$ENDCOLOR
120126
echo -e $YELLOW'80. '$ENDCOLOR'Monit - Install '$RED'(Planned)'$ENDCOLOR
121127
echo -e $YELLOW'90. '$ENDCOLOR'MakeMKV - Install '$RED'(Broken)'$ENDCOLOR
122-
echo -e $YELLOW'97. '$ENDCOLOR'See default port numbers, usernames, and passwords'
128+
echo -e $YELLOW'96. '$ENDCOLOR'See default port numbers, usernames, and passwords'
129+
echo -e $YELLOW'97. '$ENDCOLOR'Clear all backups'
123130
echo -e $YELLOW'98. '$ENDCOLOR'Clear temporary data: disclaimer consent and username'
124131
echo -e $YELLOW'99. '$ENDCOLOR'Exit'
125132

@@ -130,7 +137,7 @@ tput sgr0
130137
read option
131138
case $option in
132139
1 | 01)
133-
sudo bash update.sh "$CALLER" "$SCRIPTPATH" "$UNAME" "$UGROUP"
140+
sudo bash maintenance/update.sh "$CALLER" "$SCRIPTPATH" "$UNAME" "$UGROUP"
134141
;;
135142
2 | 02)
136143
sudo bash utils/bash_aliases-installer.sh "$CALLER" "$SCRIPTPATH" "$UNAME" "$UGROUP"
@@ -244,20 +251,20 @@ case $option in
244251
75)
245252
sudo bash webmin/webmin-installer.sh "$CALLER" "$SCRIPTPATH" "$UNAME" "$UGROUP"
246253
;;
247-
254+
76)
255+
sudo bash webmin/webmin-uninstaller.sh "$CALLER" "$SCRIPTPATH" "$UNAME" "$UGROUP"
256+
;;
257+
77)
258+
sudo bash webmin/webmin-backup.sh "$CALLER" "$SCRIPTPATH" "$UNAME" "$UGROUP"
259+
;;
260+
96)
261+
sudo bash maintenance/defaults.sh "$CALLER" "$SCRIPTPATH" "$UNAME" "$UGROUP"
262+
;;
248263
97)
249-
sudo bash defaults.sh "$CALLER" "$SCRIPTPATH" "$UNAME" "$UGROUP"
264+
sudo bash maintenance/clearbackups.sh "$CALLER" "$SCRIPTPATH" "$UNAME" "$UGROUP"
250265
;;
251-
98)
252-
echo
253-
echo -e $YELLOW'--->Clearing temporary data...'$ENDCOLOR
254-
rm $SCRIPTPATH/tmp/* >/dev/null 2>&1
255-
if [ ! -f "$SCRIPTPATH/tmp/consented" ] && [ ! -f "$SCRIPTPATH/tmp/userinfo" ]; then
256-
echo -e 'Temporary data deleted successfully...'
257-
else
258-
echo -e $RED'Deleting temporary data filed...'$ENDCOLOR
259-
fi
260-
source $SCRIPTPATH/inc/exit.sh
266+
98)
267+
sudo bash maintenance/cleartmp.sh "$CALLER" "$SCRIPTPATH" "$UNAME" "$UGROUP"
261268
;;
262269
99)
263270
echo 'Exiting...'

webmin/webmin-backup-files

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/etc/webmin/miniserv.conf

webmin/webmin-backup.sh

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
# Script Name: AtoMiC Webmin Settings Backup Script
3+
# Author: htpcBeginner
4+
# Publisher: http://www.htpcBeginner.com
5+
# License: MIT License (refer to README.md for more details)
6+
#
7+
8+
# DO NOT EDIT ANYTHING UNLESS YOU KNOW WHAT YOU ARE DOING.
9+
10+
if [[ $1 != *"setup.sh"* ]]
11+
then
12+
echo
13+
echo -e '\e[91mCannot be run directly. Please run setup.sh from AtoMiC ToolKit root folder: \033[0msudo bash setup.sh'
14+
echo
15+
exit 0
16+
fi
17+
18+
source $2/inc/commons.sh
19+
source $SCRIPTPATH/inc/header.sh
20+
21+
echo -e $GREEN'AtoMiC Webmin Settings Backup Script'$ENDCOLOR
22+
23+
source $SCRIPTPATH/inc/pause.sh
24+
25+
echo -e $YELLOW'--->Creating a list of files to backup...'$ENDCOLOR
26+
cp $SCRIPTPATH/webmin/webmin-backup-files $SCRIPTPATH/tmp/wm-backup-files
27+
28+
echo
29+
sleep 1
30+
31+
echo -e $YELLOW'--->Backing up files...'$ENDCOLOR
32+
BFN=webmin_`date '+%m-%d-%Y_%H-%M'`
33+
tar -zcvf $SCRIPTPATH/tmp/$BFN.tar.gz --ignore-failed-read --files-from $SCRIPTPATH/tmp/wm-backup-files
34+
echo
35+
echo -e $GREEN"All files / folders present from the following list were backed up:"$ENDCOLOR
36+
cat $SCRIPTPATH/tmp/wm-backup-files
37+
rm $SCRIPTPATH/tmp/wm-backup-files
38+
39+
echo
40+
sleep 1
41+
42+
echo -e $YELLOW'--->Moving backup file to '$CYAN$SCRIPTPATH'/backups/'$BFN'.tar.gz...'$ENDCOLOR
43+
mv $SCRIPTPATH/tmp/$BFN.tar.gz $SCRIPTPATH/backups/
44+
sudo chown $UNAME:$UGROUP $SCRIPTPATH/backups/$BFN.tar.gz
45+
sudo chmod 755 $SCRIPTPATH/backups/$BFN.tar.gz
46+
47+
echo
48+
sleep 1
49+
50+
echo -e $GREEN'--->All done. '$ENDCOLOR
51+
echo -e 'Webmin files backed up. You can use the restore utility to restore it on a new computer.'
52+
53+
source $SCRIPTPATH/inc/thankyou.sh
54+
source $SCRIPTPATH/inc/exit.sh

webmin/webmin-installer.sh

+14-14
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,30 @@ source $SCRIPTPATH/inc/header.sh
2121
echo -e $GREEN'AtoMiC Webmin Installer Script'$ENDCOLOR
2222

2323
source $SCRIPTPATH/inc/pause.sh
24-
source $SCRIPTPATH/inc/pkgupdate.sh
25-
26-
echo
27-
sleep 1
2824

29-
echo -e $YELLOW'--->Downloading latest Webmin...'$ENDCOLOR
30-
sudo mkdir -p /tmp/webmin
31-
cd /tmp/webmin
32-
sudo wget "http://sourceforge.net/projects/webadmin/files/webmin/"$APPVERSION"/webmin_"$APPVERSION"_all.deb"
25+
echo -e $YELLOW"--->Adding Webmin Repository..."$ENDCOLOR
26+
GREPOUT=$(grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep webmin)
27+
if [ "$GREPOUT" == "" ]; then
28+
wget -P $SCRIPTPATH/tmp/ http://www.webmin.com/jcameron-key.asc || { echo -e $RED'Error! Downloading key failed.'$ENDCOLOR ; }
29+
sudo apt-key add $SCRIPTPATH/tmp/jcameron-key.asc || { echo -e $RED'Error! Adding key failed.'$ENDCOLOR ; }
30+
echo "deb http://download.webmin.com/download/repository sarge contrib" | sudo tee -a /etc/apt/sources.list
31+
echo "deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib" | sudo tee -a /etc/apt/sources.list
32+
else
33+
echo "Webmin repository repository already exists..."
34+
fi
3335

3436
echo
3537
sleep 1
3638

37-
echo -e $YELLOW'--->Configuring Webmin Install...'$ENDCOLOR
38-
sudo dpkg --force-depends -i webmin_*.deb
39-
sudo apt-get install -f -y
39+
source $SCRIPTPATH/inc/pkgupdate.sh
4040

4141
echo
4242
sleep 1
4343

44-
echo -e $YELLOW'--->Removing temporary Webmin Files...'$ENDCOLOR
45-
sudo rm -rf /tmp/webmin
44+
echo -e $YELLOW"--->Installing Webmin and relevant packages..."$ENDCOLOR
45+
sudo apt-get -y install webmin
4646

47-
echo
47+
echo
4848
sleep 1
4949

5050
echo -e 'Starting Webmin...'

0 commit comments

Comments
 (0)