-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·33 lines (27 loc) · 1.27 KB
/
configure
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
#!/usr/bin/bash
mkdir -p ~/.config # Create config directory if it doesn't exist
touch ~/.config/mnt.ini # Create config file if it doesn't exist
# Get all disk parts with labels with simple regex
DATA=$(lsblk -nio LABEL | expand)
IFS=$'\n' # Only new-line charachter is separator
ASSOC='' # A string for output a standard disk association
IGNORING='' # A string for output a standart disk ignoring
# Get labels of parts
for var in $DATA
do
ASSOC+="$var = $var/"
IGNORING+="$var = ON/"
done
grep -B64 '<placeholder>associations</placeholder>' templates/config.ini |
grep -v '<placeholder>associations</placeholder>' > ~/.config/mnt.ini
echo ${ASSOC:0:${#ASSOC}} | tr '/' '\n' >> ~/.config/mnt.ini
grep -A64 '<placeholder>associations</placeholder>' templates/config.ini |
grep -v '<placeholder>associations</placeholder>' |
grep -B64 '<placeholder>display</placeholder>' |
grep -v '<placeholder>display</placeholder>' >> ~/.config/mnt.ini
echo ${IGNORING:0:${#ASSOC}} | tr '/' '\n' >> ~/.config/mnt.ini
grep -A64 '<placeholder>display</placeholder>' templates/config.ini |
grep -v '<placeholder>display</placeholder>' >> ~/.config/mnt.ini
echo 'The configuration file was successfully created!
Its location is ~/.config/mnt.ini
You can manually change any values specified in it'