Browse code

update photon-upgrade script

Change-Id: I9b6dc102a2cf046c26064db9ddb37ba57dffccdf
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/3914
Reviewed-by: Sharath George
Tested-by: Sharath George

Priyesh Padmavilasomb authored on 2017/09/30 08:02:51
Showing 2 changed files
... ...
@@ -68,28 +68,8 @@ function fix_packages_with_upgrade_issues() {
68 68
   fix_mesos_devel_symlink
69 69
 }
70 70
 
71
-function upgrade_tdnf() {
72
-   tdnf -y update tdnf
73
-}
74
-
75
-#because there are no 2.0 repos yet, fit to what we have.
76
-#remove when 2.0 repos are published.
77
-function upgrade_photon_release_dev() {
78
-   sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/photon.repo
79
-   sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/photon-updates.repo
80
-   cat >> /etc/yum.repos.d/_photon_upgrade_dev_.repo <<-EOF
81
-[_dev_]
82
-name=dev
83
-baseurl=https://dl.bintray.com/vmware/photon_dev_x86_64
84
-gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY
85
-gpgcheck=1
86
-enabled=1
87
-skip_if_unavailable=True
88
-EOF
89
-}
90
-
91 71
 function upgrade_photon_release() {
92
-   tdnf -y update photon-release --releasever=$LATEST_VERSION
72
+   tdnf -y update photon-release --releasever=$LATEST_VERSION --refresh
93 73
 }
94 74
 
95 75
 function distro_upgrade() {
... ...
@@ -139,6 +119,13 @@ function make_var_run_a_symlink() {
139 139
   fi
140 140
 }
141 141
 
142
+#next version of photon uses specs with dependencies
143
+#of the form x or y. update tdnf, libsolv and rpm to support it.
144
+function update_solv_to_support_complex_deps() {
145
+   tdnf -y update libsolv rpm tdnf --refresh
146
+   rebuilddb
147
+}
148
+
142 149
 function check_and_upgrade() {
143 150
   if [ $PHOTON_VERSION == $LATEST_VERSION ]; then
144 151
     echo "Your current version $PHOTON_VERSION is the latest version. Nothing to do."
... ...
@@ -152,13 +139,12 @@ function check_and_upgrade() {
152 152
 
153 153
   case $REPLY in
154 154
     [Yy]*)
155
-      upgrade_tdnf
155
+      update_solv_to_support_complex_deps
156 156
       remove_unsupported_pkgs
157 157
       fix_packages_with_upgrade_issues
158 158
       rebuilddb
159 159
       make_var_run_a_symlink
160
-      upgrade_photon_release_dev
161
-      #upgrade_photon_release
160
+      upgrade_photon_release
162 161
       distro_upgrade
163 162
       rebuilddb
164 163
       ask_for_reboot
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:    Photon upgrade scripts
2 2
 Name:       photon-upgrade
3 3
 Version:    1.0
4
-Release:    1%{?dist}
4
+Release:    2%{?dist}
5 5
 License:    Apache License
6 6
 Group:      System Environment/Base
7 7
 Source0:    photon-upgrade.sh
... ...
@@ -32,5 +32,7 @@ rm -rf $RPM_BUILD_ROOT
32 32
 %{_bindir}/*
33 33
 
34 34
 %changelog
35
+*       Fri Sep 29 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.0-2
36
+-       change script to update to new rpm for complex dependencies
35 37
 *       Wed Jun 28 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.0-1
36 38
 -       Initial