Skip to content

Commit f2b479e

Browse files
committed
Refactored bootstrap install script.
Signed-off-by: kilo52 <[email protected]>
1 parent bd4db4f commit f2b479e

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

bootstrap/install.sh

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -276,33 +276,32 @@ function install_project_init() {
276276
#
277277
function uninstall_project_init() {
278278
local question="Are you sure that you want to UNINSTALL the Project Init system? (y/N): ";
279-
if is_installed; then
280-
# Ask for confirmation unless '--yes' option was specified
281-
if [[ $ARG_ASSUME_YES == false ]]; then
282-
if ! confirm_action "$question"; then
283-
echo "Terminating...";
284-
return 1;
285-
fi
286-
fi
287-
# Check that file exists and can be removed
288-
if ! [ -w "$FOUND_INSTALLATION" ]; then
289-
echo "ERROR: Unable to remove installed file '${FOUND_INSTALLATION}'";
290-
if [ -f "$FOUND_INSTALLATION" ]; then
291-
echo "Do you have the necessary privileges?";
292-
fi
279+
if ! is_installed; then
280+
echo "The Project Init system does not seem to be installed";
281+
return 1;
282+
fi
283+
# Ask for confirmation unless '--yes' option was specified
284+
if [[ $ARG_ASSUME_YES == false ]]; then
285+
if ! confirm_action "$question"; then
286+
echo "Terminating...";
293287
return 1;
294288
fi
295-
# Remove installed file
296-
if ! rm "$FOUND_INSTALLATION"; then
297-
echo "ERROR: Failed to remove file '${FOUND_INSTALLATION}'";
298-
return 1;
289+
fi
290+
# Check that file exists and can be removed
291+
if ! [ -w "$FOUND_INSTALLATION" ]; then
292+
echo "ERROR: Unable to remove installed file '${FOUND_INSTALLATION}'";
293+
if [ -f "$FOUND_INSTALLATION" ]; then
294+
echo "Do you have the necessary privileges?";
299295
fi
300-
echo "Successfully uninstalled";
301-
return 0;
302-
else
303-
echo "The Project Init system does not seem to be installed";
296+
return 1;
304297
fi
305-
return 1;
298+
# Remove installed file
299+
if ! rm "$FOUND_INSTALLATION"; then
300+
echo "ERROR: Failed to remove file '${FOUND_INSTALLATION}'";
301+
return 1;
302+
fi
303+
echo "Successfully uninstalled";
304+
return 0;
306305
}
307306

308307
function main() {

0 commit comments

Comments
 (0)