IPS cheat sheet: Difference between revisions
m (Text replacement - "</source" to "</syntaxhighlight") |
m (Text replacement - "[[Kategorie:" to "[[Category:") |
||
Line 1: | Line 1: | ||
[[ | [[Category:Solaris11]] | ||
=Cheat sheet= | =Cheat sheet= | ||
[[File:Ips-one-liners.pdf|page=1|600px]] | [[File:Ips-one-liners.pdf|page=1|600px]] |
Latest revision as of 05:18, 26 November 2021
Cheat sheet
Examples
Switching to Oracle Support Repository
1. Get the client certificate at https://pkg-register.oracle.com/
(x) Oracle Solaris 11 Support -> Submit Comment: Rechnername -> Accept
-> Download Key -> Download Certificate
2. Copy it to your Solaris 11 host into /var/pkg/ssl.
# mv Oracle_Solaris_11_Support.key.pem /var/pkg/ssl # mv Oracle_Solaris_11_Support.certificate.pem /var/pkg/ssl
4. Set you proxy environment if needed:
# http_proxy=http://proxy:3128/ # https_proxy=http://proxy:3128/ # export http_proxy https_proxy
5. Set the publisher to the support repository:
- pkg set-publisher \
-k /var/pkg/ssl/Oracle_Solaris_11_Support.key.pem \ -c /var/pkg/ssl/Oracle_Solaris_11_Support.certificate.pem \ -G '*' -g https://pkg.oracle.com/solaris/support/ solaris
6. Refresh the catalog:
- pkg refresh --full
7. Check for updates:
- pkg update -nv
8. If needed or wanted do the update:
- pkg update -v
Adding another repository
Until now the repository of OpenCSW is not in IPS format.
Repairing packages
Damn fast fingers did it! Lucky Luk style... the man who delete files faster than his shadow...
root@solaris11:/home/lollypop# rm /usr/bin/ls
So... the file is gone... oops.
No problem in Solaris 11. You can repair package contents! But.. in which package was it?
root@solaris11:/home/lollypop# pkg search /usr/bin/ls INDEX ACTION VALUE PACKAGE path file usr/bin/ls pkg:/system/core-os@0.5.11-0.175.0.10.1.0.0
So it is in the package pkg:/system/core-os@0.5.11-0.175.0.10.1.0.0 . Let us take a look what the system thinks what is wrong with our files from this package:
root@solaris11:/home/lollypop# pkg verify pkg:/system/core-os@0.5.11-0.175.0.10.1.0.0 PACKAGE STATUS <3> pkg://solaris/system/core-os ERROR file: usr/bin/ls Missing: regular file does not exist
That is exactly what we thougt :-). So let us fix it!
root@solaris11:/home/lollypop# pkg fix pkg:/system/core-os@0.5.11-0.175.0.10.1.0.0 Verifying: pkg://solaris/system/core-os ERROR <3> file: usr/bin/ls Missing: regular file does not exist Created ZFS snapshot: 2013-04-10-07:40:21 Repairing: pkg://solaris/system/core-os DOWNLOAD PKGS FILES XFER (MB) Completed 1/1 1/1 0.0/0.0$<3> PHASE ACTIONS Update Phase 1/1 PHASE ITEMS Image State Update Phase 2/2 root@solaris11:/home/lollypop#
Beware of trying this with /usr/bin/pkg !!!
Solaris 11 release
$ LANG=C pkg info kernel | nawk '$1 == "Version:"{split($2,version,/\./)}$1 == "Branch:"{split($2,branch,/\./)}END{printf ("Solaris %d.%d Update %d SRU %d SRU-Build %d\n",version[2],version[3],branch[3],branch[4],branch[6])}'
Solaris 5.11 Update 2 SRU 0 SRU-Build 42
Update available?
#!/bin/bash
# Written by Lars Timmann <L@rs.Timmann.de> 2018
export LANG=C
function check () {
package=$1
# pkg list -af entire@latest
local=$(pkg info ${package} 2>&1)
remote=$(pkg info -r ${package} 2>&1)
latest_11_3=$(pkg list -H -af ${package} | nawk '$2 ~ /^0.5.11-0.175.3/{print $2; exit;}')
printf "%s\n%s\nLatest_11.3: %s\n" "${local}" "${remote}" "${latest_11_3}" | nawk -v package="${package}" '
BEGIN{
nr=0;
}
$1=="Version:" {
version[nr]=$2;
next;
}
$1=="Branch:" {
branch[nr++]=$2;
next;
}
$1=="Latest_11.3:" {
split($2, latest_part, "-");
latest_version=latest_part[1];
latest_branch=latest_part[2];
}
/^pkg:/ {
error=$0;
}
END{
if(error) {
printf ("Package %s:\t%s\n", package, error);
status=-1;
} else {
if(branch[0]==branch[1]){
printf ("Package %s:\tUptodate at %s\n", package, branch[0]);
status=0;
}else{
printf ("Package %s:\tUpdate is available: %s -> %s\n", package, branch[0], branch[1]);
split(version[1], version_part, /\./);
split(branch[1], branch_part, /\./);
if(version[1]=="0.5.11") {
be_version=sprintf("%d.%d.%d.%d.%d",version_part[3], branch_part[3], branch_part[4], branch_part[5], branch_part[6]);
}
if(version[1]=="11.4") {
be_version=sprintf("%d.%d.%d.%d.%d",branch_part[1], branch_part[2], branch_part[3], branch_part[5], branch_part[6]);
if (version[0]=="0.5.11" && branch[0] != latest_branch ) {
split(latest_branch, latest_part, /\./);
be_version3=sprintf("%d.%d.%d.%d.%d",version_part[3], latest_part[3], latest_part[4], latest_part[5], latest_part[6]);
printf ("\nTo update and stay in Solaris 11.3-Branch you can use:\n\tpkg install --accept --require-new-be --be-name solaris_%s\n\n", be_version3);
}else if (version[0]=="0.5.11" && branch[0] == latest_branch ) {
printf ("\nYou are at the latest version of the 11.3-Branch (%s), but you can upgrade to 11.4 .\n",branch[0]);
}
}
printf ("\n\nUse:\tpkg update --accept --require-new-be --be-name solaris_%s\n\n\n", be_version);
status=2;
}
}
exit status;
}
'
}
package="entire"
pkg refresh >/dev/null \
|| echo "Cannot refresh packages" \
&& if [ $# -gt 0 ]
then
while [ $# -gt 0 ]
do
package=$1
shift
check ${package}
done
else
check ${package}
fi
ZFS automatic snapshots
pkg install pkg:/desktop/time-slider
svcadm restart svc:/system/dbus:default