-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·107 lines (100 loc) · 3.21 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
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
#!/bin/sh
###############################################################################
# install.sh
#
# This script install DWM Scripts.
#
# -----------------------------------------------------------------------------
# DWM Scripts - wrapper for dwm/dmenu/slock
# (C) 2007-2013 Gerardo García Peña
# Programmed by Gerardo García Peña
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
###############################################################################
set -e
if ! DWM=`which dwm`; then
echo "You have not installed DWM."
if [ "$1" != "-f" -a "$1" != "--force" ]; then
echo "Use -f (--force) to force install."
exit 0
fi
fi
echo "Installing files..."
for i in dmenu-wrapper \
dwm-config-read \
dwm-msg-writer \
dwm-screenshot \
dwm-screen-lock \
dwm-say \
dwm-set-background \
dwm-shutdown \
dwm-sudo \
dwm-volume-down \
dwm-volume-get \
dwm-volume-mute \
dwm-volume-up \
dwm-windowshot \
dwm-wrapper \
dwm-xterm ; do
echo " '$i'..."
install -t "/usr/bin/" "$i"
done
echo "Installing other files..."
if [ -d "/var/lib/menu-xdg/xsessions/" ]; then
echo " 'X-Debian-WindowManagers-dwm-scripts.desktop'..."
install -t "/var/lib/menu-xdg/xsessions/" X-Debian-WindowManagers-dwm-scripts.desktop
fi
if [ -d "/usr/share/xsessions/" ]; then
echo " 'dwm-scripts.desktop'..."
install -t "/usr/share/xsessions/" dwm-scripts.desktop
fi
if [ -d "/usr/share/icons/" ]; then
echo " 'dwm-scripts.png'..."
mkdir -p "/usr/share/icons/"
install -m 664 -t "/usr/share/icons/" dwm-scripts.png
fi
FIN=""
C=0
F="default-dwm-background.jpg"
while test -z "$FIN"; do
if [ -e "/usr/share/dwm-scripts/$F" ]; then
if diff "default-dwm-background.jpg" "/usr/share/dwm-scripts/$F" > /dev/null 2>&1; then
FIN=1
else
C=$(($C+1))
F="dwm-background-$C.jpg"
fi
else
FIN=1
fi
done
echo " Default dwm background as '$F'..."
mkdir -p "/usr/share/dwm-scripts/"
install -m 664 "default-dwm-background.jpg" "/usr/share/dwm-scripts/$F"
echo "Installing config files..."
mkdir -p "/etc/dwm-scripts/"
for i in dwm-config dmenu-config; do
echo " '$i'..."
install -m 664 -t "/etc/dwm-scripts/" "$i"
done
echo "Installing doc files..."
mkdir -p "/usr/share/doc/dwm-scripts/"
for i in LICENSE README.md; do
echo " '$i'..."
install -m 664 -t "/usr/share/doc/dwm-scripts/" "$i"
done
echo "Installation ok."
exit 0