Merge ~alextu/pc-enablement/+git/pc-sanity-backgroud-photo:get_hic_cid into ~oem-solutions-engineers/pc-enablement/+git/pc-sanity-backgroud-photo:master

Proposed by Alex Tu
Status: Merged
Merged at revision: 1f53cb61d8ee18897bf4b43c17a667f230356192
Proposed branch: ~alextu/pc-enablement/+git/pc-sanity-backgroud-photo:get_hic_cid
Merge into: ~oem-solutions-engineers/pc-enablement/+git/pc-sanity-backgroud-photo:master
Diff against target: 63 lines (+20/-12)
3 files modified
debian/changelog (+7/-0)
debian/control (+1/-1)
usr/sbin/pc-sanity-backgroud-photo (+12/-11)
Reviewer Review Type Date Requested Status
Clair Lin (community) Needs Fixing
PeiYao Chang (community) Needs Fixing
Cyrus Lien Approve
Scott Hu Pending
OEM Solutions Group: Engineers Pending
Review via email: mp+423094@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Alex Tu (alextu) wrote :

you can execute this script on any machine listed on http://10.102.180.14:5000
And this is the changed wallpaper for your reference : https://photos.app.goo.gl/P4Q7Xyp6sKhh7zZn7

Revision history for this message
Cyrus Lien (cyruslien) wrote :

LGTM.

review: Approve
Revision history for this message
Alex Tu (alextu) wrote :
Revision history for this message
PeiYao Chang (baconyao) wrote :

This feature causes the debsums case failed on Stella project due to Wallpaper checking.

review: Needs Fixing
Revision history for this message
Clair Lin (clairlin) wrote :

Stella has issue that debsums fail on hp.wallpaper, please refer to the test result https://certification.canonical.com/hardware/202105-29009/submission/265276/test-results/fail/

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index f20048a..0b7ca8b 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+oem-fix-cnl-pc-sanity-backgroud-photo (0.2.8.2) focal; urgency=medium
7+
8+ * get cid from hic(http://10.102.180.14:5000/q?db) instead
9+ * Replace curl by wget because curl is not default installed, and provide fault tolerance for hic service by retry.
10+
11+ -- Alex Tu <alex.tu@canonical.com> Tue, 24 May 2022 12:58:30 +0800
12+
13 oem-fix-cnl-pc-sanity-backgroud-photo (0.2.8.1) focal; urgency=medium
14
15 * bump version
16diff --git a/debian/control b/debian/control
17index a0010c6..282672b 100644
18--- a/debian/control
19+++ b/debian/control
20@@ -8,6 +8,6 @@ Vcs-Browser: https://code.launchpad.net/~oem-solutions-engineers/pc-enablement/+
21
22 Package: oem-fix-cnl-pc-sanity-backgroud-photo
23 Architecture: all
24-Depends: ${misc:Depends}, jq
25+Depends: ${misc:Depends}, jq, imagemagick
26 Description: oem-fix-cnl-pc-sanity-backgroud-photo, add IP and hostname on screen background
27 XB-Modaliases: ${modaliases}
28diff --git a/usr/sbin/pc-sanity-backgroud-photo b/usr/sbin/pc-sanity-backgroud-photo
29index c7cdf6b..14f35e2 100755
30--- a/usr/sbin/pc-sanity-backgroud-photo
31+++ b/usr/sbin/pc-sanity-backgroud-photo
32@@ -1,19 +1,20 @@
33 #!/bin/bash
34 set -x
35 IMG_PATH="$(echo $(gsettings get org.gnome.desktop.background picture-uri) | sed 's;file://;;')"
36-LOCAL_IP=$(ip a | grep inet | awk '{print $2}' | grep 101 | cut -d '/' -f1)
37-HOSTNAME=$(cat /etc/hostname)
38+ISO_NAME="$(ubuntu-report show | jq '.OEM.DCD' | xargs | awk -F'+' '{print $2"+"$3}')"
39 CID_TABLE="cid_clabel_mapping.json"
40 eval cp ${IMG_PATH}.backup ${IMG_PATH}
41
42-echo $LOCAL_IP
43 command -v convert || (apt-get update && apt-get install -y imagemagick)
44-eval convert -pointsize 400 -fill yellow -draw \'text 270,250 \"$LOCAL_IP\" \' $IMG_PATH $IMG_PATH
45-eval convert -pointsize 200 -fill white -draw \'text 270,400 \"$(cat /etc/hostname | awk -F'-' '{print $NF}') $(ubuntu-report show | jq '.OEM.DCD' | xargs | awk -F'+' '{print $2"+"$3}')\" \' $IMG_PATH $IMG_PATH
46-
47-wget http://somerville-jenkins.cctu.space:3000/alextu/internal-db/raw/branch/master/$CID_TABLE -O /tmp/$CID_TABLE || true
48-if [ -e "/tmp/$CID_TABLE" ]; then
49- SKU=$(grep ${HOSTNAME##*-} /tmp/$CID_TABLE | awk -F'[:,]' '{print $2}'|xargs)
50- eval convert -pointsize 200 -fill yellow -draw \'text 270,600 \"$SKU\" \' $IMG_PATH $IMG_PATH
51-fi
52+eval convert -pointsize 200 -fill white -draw \'text 330,400 \"$ISO_NAME\" \' $IMG_PATH $IMG_PATH
53
54+while [ 1 ]; do
55+ for i in `cat /sys/class/net/*/address`; do
56+ SKU=$(wget http://10.102.180.14:5000/q?db -O /dev/stdout | jq -r ".[\"$i\"]")
57+ if [ -n "$SKU" ]; then
58+ eval convert -pointsize 200 -fill yellow -draw \'text 330,600 \"$SKU\" \' $IMG_PATH $IMG_PATH
59+ break 2
60+ fi
61+ done
62+ sleep 10
63+done

Subscribers

People subscribed via source and target branches