ACC SHELL
/**
* File:
* Vendor.ycp
*
* Module:
* Vendor
*
* Summary:
* provide vendor/driver update disk functions
*
* $Id: Vendor.ycp 61206 2010-03-09 14:43:12Z locilka $
*
* Author:
* Klaus Kaempf <kkaempf@suse.de>
*
*/
{
module "Vendor";
import "Installation";
import "Directory";
import "String";
// --------------------------------------------------------------
// driver update ?!
/**
* DriverUpdate
* copy /update/* to target:/tmp/update/
* !! can only be called in inst_finish !!
*/
global define void DriverUpdate1 ()
{
list<string> updatefiles = (list<string>)WFM::Read (.local.dir, ["/update", []]);
if (size (updatefiles) <= 0) {
y2milestone ("No files in /update, skipping driver update...");
return;
}
y2milestone ("Extracting driver update...");
// clean up, just in case
SCR::Execute(.target.bash, "/bin/rm -rf /tmp/update");
// copy log file
WFM::Execute(.local.bash, "l=/var/log/driverupdate.log ; [ -f $l ] && /bin/cat $l " +
">> '" + String::Quote (Installation::destdir) + "$l'");
// copy all update files from inst-sys to installed system
WFM::Execute(.local.bash, "/bin/cp -a /update " +
"'" + String::Quote (Installation::destdir) + "/tmp/update'");
string logfile = "/var/log/zypp/history";
string runcmd =
"cd /; \n" +
"for i in /tmp/update/[0-9]*/install ; do \n" +
// Logging extracting the driver update
" echo # Installing Driver Update from $i >>" + logfile + "; \n" +
" TMPFILE=${i}rpm_install_tmpfile; \n" +
" [ -x \"/bin/mktemp\" ] && TMPFILE=`/bin/mktemp`; \n" +
// Extracting the driver update archives
" cd $i; \n" +
" [ -f \"update.tar.gz\" ] && /bin/tar -zxf \"update.tar.gz\"; \n" +
" [ -f \"update.tgz\" ] && /bin/tar -zxf \"update.tgz\"; \n" +
// Installing all extracted RPMs
" rpm -Uv --force *.rpm 1>>$TMPFILE 2>>$TMPFILE; \n" +
// Logging errors
" [ -s \"$TMPFILE\" ] && echo \"# Additional rpm output:\">>" + logfile + " && sed 's/^\\(.*\\)/# \\1/' $TMPFILE>>" + logfile + "; \n" +
" rm -rf $TMPFILE; \n" +
// Running update.post script
" [ -f \"update.post\" ] && /bin/chmod +x \"update.post\" && \"./update.post\" \"$i\"; \n" +
"done;";
y2milestone ("Calling:
---------------------------------------------------------
%1
---------------------------------------------------------", runcmd);
// unpack update files and run update.post scripts
// via SCR chrooted into the installed system
integer cmd = (integer) SCR::Execute (.target.bash, runcmd);
}
global define void DriverUpdate2 ()
{
list<string> updatefiles = (list<string>)WFM::Read (.local.dir, ["/update", []]);
if (size (updatefiles) <= 0)
return;
// run update.post2 scripts
SCR::Execute(.target.bash,
"cd / ; " +
"for i in /tmp/update/[0-9]*/install ; do " +
" [ -f \"$i/update.post2\" ] && /bin/chmod +x \"$i/update.post2\" && \"$i/update.post2\" \"$i\" ; " +
"done");
// remove driver update dir
SCR::Execute(.target.bash, "/bin/rm -rf /tmp/update");
}
}
ACC SHELL 2018