Commits

Etienne Perot  committed ed69f5d

Automatically rebuild KDE startupconfig file whenever a startup-related setting is changed

  • Participants
  • Parent commits c2aa23a

Comments (0)

Files changed (7)

File modules/desktop/manifests/environment/kde/kcm/fonts.pp

 	$dpi
 ) {
 	require desktop::fonts
-	kde_rc::ini {'kcmfonts|General|dontChangeAASettings=false':}
+	kde_rc::ini {'kcmfonts|General|dontChangeAASettings=false':
+		rebuild_startup_config => true
+	}
 	kde_rc::ini {'kcmfonts|General|forceFontDPI':
-		value => $dpi
+		value => $dpi,
+		rebuild_startup_config => true
 	}
 }

File modules/desktop/manifests/environment/kde/themes/caledonia.pp

 	}
 	kde_rc::merge {'special:Add caledonia theme options to ksplash':
 		filename => 'ksplashrc',
-		source => 'desktop/environment/kde/themes/caledonia'
+		source => 'desktop/environment/kde/themes/caledonia',
+		rebuild_startup_config => true
 	}
 	kde_rc::merge {'special:Add caledonia theme options to plasmarc':
 		filename => 'plasmarc',

File modules/desktop/manifests/environment/kde/themes/oxygen.pp

 class desktop::environment::kde::themes::oxygen {
 	kde_rc::merge {'oxygenrc':
-		source => 'desktop/environment/kde/themes/oxygen'
+		source => 'desktop/environment/kde/themes/oxygen',
+		rebuild_startup_config => true
 	}
 }

File modules/kde_rc/manifests/ini.pp

 	$file = false,
 	$section = false,
 	$setting = false,
-	$value = false
+	$value = false,
+	$rebuild_startup_config = false
 ) {
 	require kde_rc::base
+	if $rebuild_startup_config {
+		include kde_rc::startupconfig
+		$tonotify = [Class['kde_rc::startupconfig']]
+	} else {
+		$tonotify = []
+	}
 	case $title {
 		/^([^|]+)\|([^|]+)\|([^=]+)=(.*)$/: {
 			if $file != false {
 			fullpath => $final_file,
 			ensure => present,
 			content => '',
-			replace => false
+			replace => false,
+			notify => $tonotify
 		}
 	}
 	enduser_file::ini {"$final_file/$actual_section/$actual_setting":
 		setting => $actual_setting,
 		value => $actual_value,
 		key_val_separator => '=',
-		require => Kde_rc[$final_file]
+		require => Kde_rc[$final_file],
+		notify => $tonotify
 	}
 }

File modules/kde_rc/manifests/init.pp

 	$mode = 0600,
 	$source = false,
 	$content = false,
-	$replace = true
+	$replace = true,
+	$rebuild_startup_config = false
 ) {
+	if $rebuild_startup_config {
+		include kde_rc::startupconfig
+		$tonotify = [Class['kde_rc::startupconfig']]
+	} else {
+		$tonotify = []
+	}
 	require kde_rc::base
 	if $fullpath == false {
 		$final_path = ".kde4/share/config/$name"
 		mode => $mode,
 		source => $source,
 		content => $content,
-		replace => $replace
+		replace => $replace,
+		notify => $tonotify
 	}
 }

File modules/kde_rc/manifests/merge.pp

 	$content = false,
 	$filename = $name,
 	$fullpath = false,
-	$absolutepath = false
+	$absolutepath = false,
+	$rebuild_startup_config = false
 ) {
+	if $rebuild_startup_config {
+		include kde_rc::startupconfig
+		$tonotify = [Class['kde_rc::startupconfig']]
+	} else {
+		$tonotify = []
+	}
 	require kde_rc::base
 	case $source {
 		false: {
 	if $absolutepath {
 		if ! defined(File[$absolutepath]) {
 			file {$absolutepath:
-				ensure => present
+				ensure => present,
+				notify => $tonotify
 			}
 		}
 		if $content == false {
 				path => $absolutepath,
 				source => $multisource,
 				key_val_separator => '=',
-				require => File[$absolutepath]
+				require => File[$absolutepath],
+				notify => $tonotify
 			}
 		} else {
 			$content_md5 = md5($content)
 				path => $absolutepath,
 				content => $content,
 				key_val_separator => '=',
-				require => File[$absolutepath]
+				require => File[$absolutepath],
+				notify => $tonotify
 			}
 		}
 	} else {
 			kde_rc {$final_file:
 				fullpath => $final_file,
 				ensure => present,
-				replace => false
+				replace => false,
+				notify => $tonotify
 			}
 		}
 		if $content == false {
 				path => "/home/etienne/$final_file",
 				source => $multisource,
 				key_val_separator => '=',
-				require => Kde_rc[$final_file]
+				require => Kde_rc[$final_file],
+				notify => $tonotify
 			}
 			ini_setting {"/root/$final_file merged file $source":
 				path => "/root/$final_file",
 				source => $multisource,
 				key_val_separator => '=',
-				require => Kde_rc[$final_file]
+				require => Kde_rc[$final_file],
+				notify => $tonotify
 			}
 		} else {
 			$content_md5 = md5($content)
 				path => "/home/etienne/$final_file",
 				content => $content,
 				key_val_separator => '=',
-				require => Kde_rc[$final_file]
+				require => Kde_rc[$final_file],
+				notify => $tonotify
 			}
 			ini_setting {"/root/$final_file merged md5 $content_md5":
 				path => "/root/$final_file",
 				content => $content,
 				key_val_separator => '=',
-				require => Kde_rc[$final_file]
+				require => Kde_rc[$final_file],
+				notify => $tonotify
 			}
 		}
 	}

File modules/kde_rc/manifests/startupconfig.pp

+class kde_rc::startupconfig {
+	exec {'Refresh etienne KDE4 startupconfig':
+		command => shellquote(
+			'/usr/bin/env', 'kstartupconfig4'
+		),
+		refreshonly => true,
+		user => 'etienne',
+		environment => [
+			'HOME=/home/etienne'
+		],
+		cwd => '/home/etienne',
+		provider => 'shell'
+	}
+	exec {'Refresh root KDE4 startupconfig':
+		command => shellquote(
+			'/usr/bin/env', 'kstartupconfig4'
+		),
+		refreshonly => true,
+		user => 'root',
+		environment => [
+			'HOME=/root'
+		],
+		cwd => '/root',
+		logoutput => true
+	}
+}