@@ -21,16 +21,16 @@ USE_SYSTEM_WLROOTS=disabled
2121
2222# Temporarily disable exit on error
2323set +e
24- options=$( getopt -o hvcs:p: --long verbose --long clean --long stream: --long prefix: --long system-wlroots -- $@ )
25- ERROR_CODE=$?
24+ options=" $( getopt -o hvcs:p: --long verbose --long clean --long stream: --long prefix: --long system-wlroots -- " $@ " ) "
25+ ERROR_CODE=" $? "
2626set -e
2727
28- if [ $ERROR_CODE != 0 ]; then
28+ if [ " $ERROR_CODE " != 0 ]; then
2929 print_help
3030 exit 1
3131fi
3232
33- eval set -- $options
33+ eval set -- " $options "
3434while true ; do
3535 case $1 in
3636 -v|--verbose)
@@ -41,11 +41,11 @@ while true; do
4141 ;;
4242 -s|--stream)
4343 shift
44- STREAM=$1
44+ STREAM=" $1 "
4545 ;;
4646 -p|--prefix)
4747 shift
48- PREFIX=$1
48+ PREFIX=" $1 "
4949 ;;
5050 --system-wlroots)
5151 USE_SYSTEM_WLROOTS=enabled
@@ -60,7 +60,7 @@ while true; do
6060 shift
6161done
6262
63- if [ $VERBOSE = 1 ]; then
63+ if [ " $VERBOSE " = 1 ]; then
6464 set -x
6565fi
6666
@@ -71,7 +71,7 @@ BUILDROOT="$(cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
7171function ask_confirmation {
7272 while true ; do
7373 read -p " $1 " yn
74- case $yn in
74+ case " $yn " in
7575 [Yy]* ) yn=Y; break ;;
7676 [Nn]* ) yn=N; break ;;
7777 * ) echo " Please answer yes or no." ;;
@@ -81,13 +81,13 @@ function ask_confirmation {
8181
8282# Usually we use sudo, but if prefix is somewhere in ~/, we don't need sudo
8383SUDO=sudo
84- if [ -w $PREFIX ] || ! which sudo > /dev/null; then
84+ if [ -w " $PREFIX " ] || ! which sudo > /dev/null; then
8585 SUDO=
8686fi
8787
88- if [ ${USE_SYSTEM_WLROOTS} = disabled ] && [ $PREFIX = /usr ]; then
88+ if [ " ${USE_SYSTEM_WLROOTS} " = disabled ] && [ " $PREFIX " = /usr ]; then
8989 ask_confirmation ' The installation of Wayfire may overwrite any system-wide wlroots installation. Continue[y/n]? '
90- if [ ${yn} = N ]; then
90+ if [ " ${yn} " = N ]; then
9191 exit
9292 fi
9393fi
9696
9797# First argument: name of the repository to clone
9898check_download () {
99- cd $BUILDROOT
100- if [ ! -d $1 ] || [ $CLEANBUILD = 1 ]; then
101- rm -rf $1
102- git clone https://github.com/WayfireWM/$1
99+ cd " $BUILDROOT "
100+ if [ ! -d " $1 " ] || [ " $CLEANBUILD " = 1 ]; then
101+ rm -rf " $1 "
102+ git clone " https://github.com/WayfireWM/$1 "
103103 fi
104104
105105 # Checkout the correct stream
106- cd $1
107- git checkout origin/${STREAM}
106+ cd " $1 "
107+ git checkout " origin/${STREAM} "
108108}
109109
110110check_download wayfire
111111check_download wf-shell
112112
113- cd $BUILDROOT /wayfire
113+ cd " $BUILDROOT /wayfire"
114114
115- meson build --prefix=${PREFIX} -Duse_system_wfconfig=disabled -Duse_system_wlroots=${USE_SYSTEM_WLROOTS}
115+ meson build --prefix=" ${PREFIX} " -Duse_system_wfconfig=disabled -Duse_system_wlroots=" ${USE_SYSTEM_WLROOTS} "
116116ninja -C build
117117$SUDO ninja -C build install
118- DEST_LIBDIR=$( meson configure | grep libdir | awk ' {print $2}' )
118+ DEST_LIBDIR=" $( meson configure | grep libdir | awk ' {print $2}' ) "
119119
120- cd $BUILDROOT /wf-shell
121- PKG_CONFIG_PATH=$PKG_CONFIG_PATH :${PREFIX} /${DEST_LIBDIR} /pkgconfig meson build --prefix=${PREFIX}
120+ cd " $BUILDROOT /wf-shell"
121+ PKG_CONFIG_PATH=" $PKG_CONFIG_PATH :${PREFIX} /${DEST_LIBDIR} /pkgconfig" meson build --prefix=" ${PREFIX} "
122122ninja -C build
123123$SUDO ninja -C build install
124124
130130# First argument is the name of the file
131131# Second argument is the name of the template
132132function install_config {
133- CONFIG_FILE=$BUILDROOT /$1
134- cp $2 $CONFIG_FILE
133+ CONFIG_FILE=" $BUILDROOT /$1 "
134+ cp " $2 " " $CONFIG_FILE "
135135
136- DEFAULT_CONFIG_PATH=${HOME} /.config/$1
136+ DEFAULT_CONFIG_PATH=" ${HOME} /.config/$1 "
137137 if [ " ${XDG_CONFIG_HOME} " != " " ]; then
138- DEFAULT_CONFIG_PATH=${XDG_CONFIG_HOME} /$1
138+ DEFAULT_CONFIG_PATH=" ${XDG_CONFIG_HOME} /$1 "
139139 fi
140140
141- if [ -f ${DEFAULT_CONFIG_PATH} ]; then
141+ if [ -f " ${DEFAULT_CONFIG_PATH} " ]; then
142142 ask_confirmation " Do you want to override the existing config file ${DEFAULT_CONFIG_PATH} [y/n]? "
143143 else
144144 yn=Y
145145 fi
146146
147- if [ $yn = Y ]; then
148- mkdir -p $( dirname ${DEFAULT_CONFIG_PATH} )
149- cp ${CONFIG_FILE} ${DEFAULT_CONFIG_PATH} --backup=t
147+ if [ " $yn " = Y ]; then
148+ mkdir -p " $( dirname " ${DEFAULT_CONFIG_PATH} " ) "
149+ cp " ${CONFIG_FILE} " " ${DEFAULT_CONFIG_PATH} " --backup=t
150150 fi
151151}
152152
153- install_config wayfire.ini $BUILDROOT /wayfire/wayfire.ini
154- install_config wf-shell.ini $BUILDROOT /wf-shell/wf-shell.ini.example
153+ install_config wayfire.ini " $BUILDROOT /wayfire/wayfire.ini"
154+ install_config wf-shell.ini " $BUILDROOT /wf-shell/wf-shell.ini.example"
155155
156156# Generate a startup script, setting necessary env vars.
157- cp $BUILDROOT /start_wayfire.sh.in $BUILDROOT /start_wayfire.sh
158- if [ ${PREFIX} != ' /usr' ]; then
159- sed -i " s@^LD_.*@export LD_LIBRARY_PATH=${PREFIX} /${DEST_LIBDIR} :\$ LD_LIBRARY_PATH@g" $BUILDROOT /start_wayfire.sh
160- sed -i " s@^PATH.*@export PATH=${PREFIX} /bin:\$ PATH@g" $BUILDROOT /start_wayfire.sh
161- sed -i " s@^XDG_.*@export XDG_DATA_DIRS=${PREFIX} /share:\$ XDG_DATA_DIRS@g" $BUILDROOT /start_wayfire.sh
157+ cp " $BUILDROOT /start_wayfire.sh.in" " $BUILDROOT /start_wayfire.sh"
158+ if [ " ${PREFIX} " != ' /usr' ]; then
159+ sed -i " s@^LD_.*@export LD_LIBRARY_PATH=${PREFIX} /${DEST_LIBDIR} :\$ LD_LIBRARY_PATH@g" " $BUILDROOT /start_wayfire.sh"
160+ sed -i " s@^PATH.*@export PATH=${PREFIX} /bin:\$ PATH@g" " $BUILDROOT /start_wayfire.sh"
161+ sed -i " s@^XDG_.*@export XDG_DATA_DIRS=${PREFIX} /share:\$ XDG_DATA_DIRS@g" " $BUILDROOT /start_wayfire.sh"
162162fi
163- $SUDO install -m 755 $BUILDROOT /start_wayfire.sh $PREFIX /bin/startwayfire
163+ $SUDO install -m 755 " $BUILDROOT /start_wayfire.sh" " $PREFIX /bin/startwayfire"
164164
165165ask_confirmation " Do you want to install wayfire-plugins-extra? [y/n]? "
166- if [ $yn = Y ]; then
166+ if [ " $yn " = Y ]; then
167167 check_download wayfire-plugins-extra
168- cd $BUILDROOT /wayfire-plugins-extra
169- PKG_CONFIG_PATH=$PKG_CONFIG_PATH :${PREFIX} /${DEST_LIBDIR} /pkgconfig meson build --prefix=${PREFIX}
168+ cd " $BUILDROOT /wayfire-plugins-extra"
169+ PKG_CONFIG_PATH=" $PKG_CONFIG_PATH :${PREFIX} /${DEST_LIBDIR} /pkgconfig" meson build --prefix=" ${PREFIX} "
170170 ninja -C build
171171 $SUDO ninja -C build install
172172fi
173173
174174ask_confirmation " Do you want to install WCM, a graphical configuration tool for Wayfire [y/n]? "
175- if [ $yn = Y ]; then
175+ if [ " $yn " = Y ]; then
176176 check_download wcm
177- cd $BUILDROOT /wcm
178- PKG_CONFIG_PATH=$PKG_CONFIG_PATH :${PREFIX} /${DEST_LIBDIR} /pkgconfig meson build --prefix=${PREFIX}
177+ cd " $BUILDROOT /wcm"
178+ PKG_CONFIG_PATH=" $PKG_CONFIG_PATH :${PREFIX} /${DEST_LIBDIR} /pkgconfig" meson build --prefix=" ${PREFIX} "
179179 ninja -C build
180180 $SUDO ninja -C build install
181181fi
@@ -186,12 +186,12 @@ if [ -w $SESSIONS_DIR ] || ! which sudo > /dev/null; then
186186 SUDO_FOR_SESSIONS=
187187fi
188188ask_confirmation " Do you want to install wayfire.desktop to $SESSIONS_DIR / [y/n]? "
189- if [ $yn = Y ]; then
190- cp $BUILDROOT /wayfire.desktop.in $BUILDROOT /wayfire.desktop
191- sed -i " s@^Exec.*@Exec=$PREFIX /bin/startwayfire@g" $BUILDROOT /wayfire.desktop
192- sed -i " s@^Icon.*@Icon=$PREFIX /share/wayfire/icons/wayfire.png@g" $BUILDROOT /wayfire.desktop
193- $SUDO_FOR_SESSIONS mkdir -p $SESSIONS_DIR
194- $SUDO_FOR_SESSIONS install -m 644 $BUILDROOT /wayfire.desktop $SESSIONS_DIR
189+ if [ " $yn " = Y ]; then
190+ cp " $BUILDROOT /wayfire.desktop.in" " $BUILDROOT /wayfire.desktop"
191+ sed -i " s@^Exec.*@Exec=$PREFIX /bin/startwayfire@g" " $BUILDROOT /wayfire.desktop"
192+ sed -i " s@^Icon.*@Icon=$PREFIX /share/wayfire/icons/wayfire.png@g" " $BUILDROOT /wayfire.desktop"
193+ $SUDO_FOR_SESSIONS mkdir -p " $SESSIONS_DIR "
194+ $SUDO_FOR_SESSIONS install -m 644 " $BUILDROOT /wayfire.desktop" " $SESSIONS_DIR "
195195fi
196196
197197echo " Installation done. Run $PREFIX /bin/startwayfire to start wayfire."
0 commit comments