forked from vanlocvo/Nautilus-OpenInVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·52 lines (49 loc) · 1.33 KB
/
install.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
#!/bin/bash
restart_nautilus()
{
read -p "Do you want restart Nautilus (Files) [Y/N]? " VAR
if [[ $VAR = 'y' || $VAR = 'Y' ]]; then
nautilus -q
fi
}
cp_file() {
FILE=vscodium-nautilus.py
TARGDIR=$1
if [[ ! -d $TARGDIR ]]; then
mkdir -v -p "$TARGDIR"
fi
cp -v "$FILE" "$TARGDIR"
restart_nautilus
}
cp_file_sudo() {
FILE=vscodium-nautilus.py
TARGDIR=$1
if [[ ! -d $TARGDIR ]]; then
sudo mkdir -v -p "$TARGDIR"
fi
sudo cp -v "$FILE" "$TARGDIR"
restart_nautilus
}
if [[ $UID != 0 ]]; then
read -p "This script is running without sudo, install for current user [Y/N]? " VAR
if [[ $VAR = 'y' || $VAR = 'Y' ]]; then
TARGDIR=~/.local/share/nautilus-python/extensions
cp_file "$TARGDIR"
else
read -p "Do you want install for all user [Y/N]? " VAR
if [[ $VAR = 'y' || $VAR = 'Y' ]]; then
TARGDIR=/usr/share/nautilus-python/extensions
cp_file_sudo "$TARGDIR"
else
echo "Install failed!"
fi
fi
else
read -p "This script is running with sudo, install for all user [Y/N]? " VAR
if [[ $VAR = 'y' || $VAR = 'Y' ]]; then
TARGDIR=/usr/share/nautilus-python/extensions
cp_file "$TARGDIR"
else
echo "Install failed!"
fi
fi