From 96ac3596f8735f3a416627681eca393244fc44ad Mon Sep 17 00:00:00 2001 From: ANDRoid7890 Date: Mon, 8 Feb 2021 14:28:37 +0400 Subject: [PATCH] fixed mkinitcpio.conf updating --- PKGBUILD | 4 ++-- main.cpp | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 130501a..617f6b1 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: ANDRoid7890 pkgname=bootsplash-manager -pkgver=1.0 +pkgver=1.1 pkgrel=1 pkgdesc="Simple cli bootsplash manager" url="https://github.com/ANDRoid7890/bootsplash-manager" @@ -16,7 +16,7 @@ source=("CMakeLists.txt" "org.manjaro.bootsplash-manager.policy") md5sums=('c15c5c3dbb5d60868db08caaf63ff901' - '8a8ef82d4ad27e743d38be739724a463' + 'fd9706296aeb49b51d4d026d7691693d' 'bff11696553f09c850aee775a83ba4d3') build() { diff --git a/main.cpp b/main.cpp index d1d706c..39497a6 100644 --- a/main.cpp +++ b/main.cpp @@ -139,9 +139,14 @@ int setTheme( QString theme ){ position = data.indexOf( QRegularExpression("^HOOKS=.*") ); hooks = data.at( position ); - QStringList hooksList = hooks.replace( QRegularExpression("^HOOKS="), "" ) - .replace('"', "") - .split(' '); + bool bracketsFlag = hooks.contains( QRegularExpression("^HOOKS=[(].*") ); + + hooks.replace( QRegularExpression("^HOOKS="), "" ); + if ( bracketsFlag ) hooks.replace('(', "") + .replace(')', ""); + else hooks.replace('"', ""); + + QStringList hooksList = hooks.split(' '); bool hooksFlag=1; for ( const QString& t : qAsConst(themesList) ) if ( !hooksList.contains( "bootsplash-"+t ) ) @@ -156,9 +161,9 @@ int setTheme( QString theme ){ for ( const QString& t : qAsConst(themesList) ) hooksList.append( "bootsplash-"+t ); hooks.clear(); - hooks="HOOKS=\""; + hooks=bracketsFlag?"HOOKS=(":"HOOKS=\""; for ( const QString& s : qAsConst(hooksList) ) hooks.append( s ).append( ' ' ); - hooks.replace( QRegularExpression( "\\s$" ), "\"" ); + hooks.replace( QRegularExpression( "\\s$" ), bracketsFlag?")":"\"" ); data.replace( position, hooks ); // write initcpio