Skip to content

Commit 2837e64

Browse files
authored
Merge pull request #25 from jsmaniac/patch-sudo-install
Test need for sudo for copying wayfire.desktop to /usr/share/wayland-sessions
2 parents 08ebe7d + ab7b3fc commit 2837e64

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

install.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,18 @@ if [ $yn = Y ]; then
180180
$SUDO ninja -C build install
181181
fi
182182

183-
SESSIONS_DIR=/usr/share/wayland-sessions
183+
SESSIONS_DIR=/usr/share/wayland-sessions/
184+
SUDO_FOR_SESSIONS=sudo
185+
if [ -w $SESSIONS_DIR ] || ! which sudo > /dev/null; then
186+
SUDO_FOR_SESSIONS=
187+
fi
184188
ask_confirmation "Do you want to install wayfire.desktop to $SESSIONS_DIR/ [y/n]? "
185189
if [ $yn = Y ]; then
186190
cp $BUILDROOT/wayfire.desktop.in $BUILDROOT/wayfire.desktop
187191
sed -i "s@^Exec.*@Exec=$PREFIX/bin/startwayfire@g" $BUILDROOT/wayfire.desktop
188192
sed -i "s@^Icon.*@Icon=$PREFIX/share/wayfire/icons/wayfire.png@g" $BUILDROOT/wayfire.desktop
189-
$SUDO install -m 644 $BUILDROOT/wayfire.desktop $SESSIONS_DIR
193+
$SUDO_FOR_SESSIONS mkdir -p $SESSIONS_DIR
194+
$SUDO_FOR_SESSIONS install -m 644 $BUILDROOT/wayfire.desktop $SESSIONS_DIR
190195
fi
191196

192197
echo "Installation done. Run $PREFIX/bin/startwayfire to start wayfire."

0 commit comments

Comments
 (0)