-
Notifications
You must be signed in to change notification settings - Fork 0
/
s_folder.sh
91 lines (75 loc) · 1.57 KB
/
s_folder.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
#!/bin/bash
export LANG=""
cd ~/setup/
WIZARD=$1
trap bashtrap INT
bashtrap()
{
bash ~/setup/setup.sh
}
function startfn {
echo ""
echo "Stopping MySQL"
sudo stop mysql
echo "Stopping Samba"
sudo service smbd stop
echo "----------"
echo ""
echo "Setting up Drive Permissions"
sudo chgrp plugdev /media/data
sudo chmod g+w /media/data
sudo chmod +t /media/data
echo ""
echo "Extracting Folders & Files"
# tar pczf ~/data_drive.tar.gz /media/data --exclude=/media/data/lost+found
sudo tar -pxzf ~/data_drive.tar.gz -C /
echo "--- done ---"
echo ""
echo "Applying Folder Permissions"
echo ""
sudo chown -R mysql:mysql /media/data/mysql
echo "MySQL - done"
echo ""
sudo chown -R www-data:www-data /media/data/backups
echo "Backups - done"
echo ""
sudo chown -R www-data:www-data /media/data/uploads
echo "Uploads - done"
echo ""
sudo chown -R www-data:www-data /media/data/web
if [ -d /media/data/wip ]; then
sudo chown -R www-data:www-data /media/data/wip
fi
echo "Impreshin - done"
echo ""
echo "----------"
echo "Starting MySQL"
sudo start mysql
echo "Starting Samba"
sudo service smbd start
finish
}
function finish {
echo "--- Done ---"
endfn
}
function endfn {
echo ""
echo ""
read -p "Press [Enter] key to continue..."
if [ -n "$WIZARD" ]; then
bash ./s_database.sh "$WIZARD"
else
bash ./setup.sh " - Folders & Files Done"
fi
}
clear
echo "Folders & Files"
echo "-----------------------------------------------"
echo ""
read -e -p "Continue?: " -i "y" goonfn
if [ $goonfn = "y" ]; then
startfn
else
endfn
fi