Changes

From SME Server
Jump to navigationJump to search
2,998 bytes added ,  11:26, 9 April 2021
no edit summary
Line 55: Line 55:  
   #services we need to restart
 
   #services we need to restart
 
   #safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/some service");
 
   #safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/some service");
 +
 +
Uncomment (and duplicate if necessary) any lines that are required.
    
The Build:Createlinks package has other useful routines as well.
 
The Build:Createlinks package has other useful routines as well.
Line 60: Line 62:  
===Other ways to create the -update event===
 
===Other ways to create the -update event===
   −
In the extreme case where no action is required, but you want to suppress the post-upgrade;reboot message, the you can create the event directory using mkdir -p in the .spec file, but leave the contents empty. This can be done under the %setup directive as follows:
+
In the extreme case where no action is required, but you want to suppress the post-upgrade;reboot message, then you can create the event directory using mkdir -p in the .spec file, but leave the contents empty. This can be done under the %setup directive as follows:
    
  %setup
 
  %setup
Line 69: Line 71:     
  %build
 
  %build
 +
 +
The other lalternatives are to add the directories and contents in the data tree for the rpm.
 +
 +
===Creating the -update event at the command line===
 +
 +
Scripts to create the -update event and associated updtes to the spec file are shown here incase the prove useful:
 +
 +
====Update the changelog in the spec file====
 +
 +
[brianr@smebuild ~]$ cat bin/editcontrib-spec1
 +
#!/bin/bash
 +
cd ~/smecontribs/rpms/$1/contribs10;pwd;ls;rm -f $1.spec;prepa;
 +
BogusDateBot.sh $1.spec
 +
changelog $1.spec
 +
BUGNO=$(cat ~/bugzillas.csv | grep "$1" | awk -F',' '{print $5}')
 +
echo "Found bug $BUGNO"
 +
sed -i -c  's/\- fix/- Add Update event to createlinks/' $1.spec
 +
sed -i -c "s/\[SME: \]/[SME: $BUGNO]/" $1.spec
 +
vim -R $1.spec
 +
[brianr@smebuild ~]$
 +
 +
====Update the createlinks file====
 +
 +
[brianr@smebuild ~]$ cat bin/editcontrib-createlinks1
 +
#!/bin/bash
 +
#edit-createlinks1
 +
cd ~/smecontribs/rpms/$1/contribs10;pwd;ls;
 +
TREEDIR=$(find . -name 'createlinks' | grep -v 'old')
 +
cd $(dirname $TREEDIR);pwd
 +
sed -i -c "/#! *\/usr\/bin\/perl/a\\
 +
use esmith::Build::CreateLinks qw(:all);\\
 +
# our event specific for updating with yum without reboot\\
 +
\$event = '$1-update';\\
 +
#add here the path to your templates needed to expand\\
 +
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event\\
 +
\\
 +
foreach my \$file (qw(\\
 +
                /etc/systemd/system-preset/49-koozali.preset\\
 +
))\\
 +
{\\
 +
    templates2events( \$file, \$event );\\
 +
}\\
 +
#action needed in case we have a systemd unit\\
 +
event_link('systemd-default', \$event, '10');\\
 +
event_link('systemd-reload', \$event, '50');\\
 +
#action specific to this package\\
 +
#event_link('action', \$event, '30');\\
 +
#services we need to restart\\
 +
#safe_symlink('restart',"root/etc/e-smith/events/\$event/services2adjust/service");\\
 +
#and Server Manager panel link\\
 +
#panel_link('somefunction', 'manager');\\
 +
\\
 +
" createlinks
 +
vim -R createlinks
 +
[brianr@smebuild ~]$
 +
 +
====Generate Patch and Update spec file====
 +
 +
[brianr@smebuild ~]$ cat bin/editcontrib-patch
 +
#!/bin/bash
 +
# Editcontrib-patch
 +
cd ~/smecontribs/rpms/$1/contribs10;pwd;
 +
FOLDER=$(find . -type d -name "$1*" | grep -v "old" | grep -v "el7_sme")
 +
FOLDER=$(echo $FOLDER | sed 's?./??')
 +
echo $FOLDER
 +
patchit.sh $FOLDER 'Add-Update-event-to-createlinks'
 +
PATCHFILE=$(ls *.patch | grep "Add-Update-event-to-createlinks")
 +
vim -R $PATCHFILE
 +
echo $PATCHFILE
 +
RELEASE=$(cat $1.spec | grep -i "%define release" | awk -F " " '{print $3}')
 +
sed -i -c  "/Source:/a \\
 +
Patch$RELEASE: $PATCHFILE" $1.spec
 +
sed -i -c  "/%setup/a \\
 +
%patch$RELEASE -p1" $1.spec
 +
vim -R $1.spec
 +
[brianr@smebuild ~]$
 +
 +
=====Patch script=====
 +
 +
[brianr@smebuild ~]$ cat bin/patchit.sh
 +
#!/bin/sh
 +
#
 +
# Generate a patch file
 +
# $1 directory name (without the old)
 +
# $2 name of the patch file (sans .patch)
 +
#
 +
diff -urN $1.old/ $1/ >$1-$2.patch
 +
ls -l $1-$2.patch
 +
[brianr@smebuild ~]$

Navigation menu