Kadischi/Development/07conf

From FedoraProject

Jump to: navigation, search

Fedora Kadischi Development

The following script was coded by MattBird.

Stop (medium size).png
The Paths below may need to be changed!

This is a "under development" zone. The author takes no responsibility whatsoever.

Progress

The script below which I have installed as /usr/local/share/kadischi/post_install_scripts/07conf.pl runs after the other Kadischi 'post install scripts' and sets the Gnome desktop background, splash screen and the run level for the Live CD. As the script runs it will prompt the user for chosen settings. It will then adjust the config for the live CD. Unlike previous versions this script may be run 'as is' although regular users of Kadischi may find it useful to change the Default settings section.

I hacked this together for my own use, its included in the hope someone else may benifit. --MattBird

Warning (medium size).png
The Default paths can be set to what you like.
#!/usr/bin/perl


<!-- Perl script written by Matt Bird - mb <AT> manasystems DOT co DOT uk for more info.
-->
<!-- Distributed under the GPL 2 License
-->

<!--#############Default Settings (User Defined)######################
-->
<!--#################################################################
-->

my $dsrcfile=qq{/PATH/TO/IMAGE.png};    #Default Desktop Image
my $dspsrcfile=qq{/PATH/TO/IMAGE.png};  #Default Splash Image
my  $dnewrunlev=3;
<!--######################################################################
-->

open (CONF, "/etc/kadischi/kadischi.conf");    #Was build.conf in earlier versions
@CONF=<CONF>;
close (CONF);

@BDIR=grep(/BUILDDIR=/, @CONF);
$BDIR=@BDIR[1] ;
($tmp,$builddir)= split(/=/,$BDIR);

@BNUM=grep(/BUILDNUM=/, @CONF);
$BNUM=@BNUM[0] ;
($tmp,$buildnum)= split(/=/,$BNUM);
chomp ($buildnum);
chomp($builddir);

<!--###########################Enter Details Prompt ############################################
-->
print "Enter full path to new desktop image\n"; $srcfile=<>;chomp($srcfile);
if ($srcfile==""){$srcfile=$dsrcfile};   #Dont replace if 'Enter'

print "Enter full path to new splash screen\n"; $spsrcfile=<>;chomp($spsrcfile);
if ($spsrcfile==""){$spsrcfile=$dspsrcfile};   #Dont replace if 'Enter'

print "Enter new run level\n"; $newrunlev=<>;chomp($newrunlev);

if ($newrunlev==""){$newrunlev=$dnewrunlev};        #Dont replace if 'Enter'
<!--###################### Copy Local image to Live CD Desktop###################################################
-->

my $destfile=qq{/$builddir/livecd-build_no$buildnum/system/usr/share/backgrounds/images/default.png};

@copydesktop = ("cp", "$srcfile", "$destfile");

system(@copydesktop);

<!--####################### This section changes the Fedora 'Splash Screen' as X loads###################
-->

my $spdestfile=qq{/$builddir/livecd-build_no$buildnum/system/usr/share/pixmaps/splash/gnome-splash.png};
@copysplash = ("cp", "$spsrcfile", "$spdestfile");
system(@copysplash);
<!--###########################################################################################################
-->


<!--#################### Set runlevel of Live CD#################################################################
-->

open (INTB, "/$builddir/livecd-build_no$buildnum/system/etc/inittab");
@INTB=<INTB>;
close (INTB);
my $newval=qq{id:$newrunlev:initdefault:};
foreach $elem (@INTB){
if ($elem=~"id"){
$elem=$newval;
}
}

open (WINTB,">/$builddir/livecd-build_no$buildnum/system/etc/inittab");
print WINTB "@INTB";
close (WINTB);