Merge ~bladernr/plainbox-provider-certification-server:precheck-sid-recheck into plainbox-provider-certification-server:master

Proposed by Jeff Lane 
Status: Merged
Approved by: Sylvain Pineau
Approved revision: d2bc459929a69996a3d9735fc2592e68009a8385
Merged at revision: fac1cb29426d6079ad0b5ada67f03380443ad185
Proposed branch: ~bladernr/plainbox-provider-certification-server:precheck-sid-recheck
Merge into: plainbox-provider-certification-server:master
Diff against target: 48 lines (+21/-5)
1 file modified
tools/canonical-certification-precheck (+21/-5)
Reviewer Review Type Date Requested Status
Pierre Equoy Approve
Jeff Lane  Needs Resubmitting
Review via email: mp+307221@code.launchpad.net

Description of the change

Modified the SecureID check to now validate existing or newly entered SIDs

To post a comment you must log in.
Revision history for this message
Pierre Equoy (pieq) wrote :

line 94 of the script you have the following:

    echo " secure_id is configured as $secureid Is this correct? [Y/n]"

If the $secureid is empty, you end up with this displayed on screen:

 secure_id is configured as Is this correct? [Y/n]

I find that a bit confusing.

Maybe using the following would be better:

    echo " secure_id is configured as '$secureid'.\n Is this correct? [Y/n]"

review: Needs Fixing
Revision history for this message
Pierre Equoy (pieq) wrote :

As Sam pointed out to me, my suggestion should be:

echo -e " secure_id is configured as '$secureid'.\n Is this correct? [Y/n]"

(added '-e'. I'm using zsh and when I tried in my term I didn't need the '-e')

Revision history for this message
Jeff Lane  (bladernr) wrote :

It seems that the preference in the "world" is to use printf in favor of echo, but I'm not going to go through and change all that right now. Maybe later (though I think this is big enough that it really needs to be converted to a Python tool at this point).

Anyway, I've changed it with Echo statements to match what Pierre suggested.

review: Needs Resubmitting
Revision history for this message
Pierre Equoy (pieq) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tools/canonical-certification-precheck b/tools/canonical-certification-precheck
2index 829abf1..46190c5 100755
3--- a/tools/canonical-certification-precheck
4+++ b/tools/canonical-certification-precheck
5@@ -74,22 +74,38 @@ fi
6 }
7
8 # Secure ID is set in /etc/xdg/canonical-certification.conf (?)
9+configure_SID(){
10+ read -e -p " Please enter the secure_id of your SUT: " sid
11+ if grep "#secure_id" /etc/xdg/canonical-certification.conf >/dev/null ; then
12+ sudo sed -i "s/#\[transport:c3\]/\[transport:c3\]/g" /etc/xdg/canonical-certification.conf
13+ sudo sed -i "s/#secure_id =.*/secure_id = $sid/g" /etc/xdg/canonical-certification.conf
14+ else
15+ sudo sed -i "s/secure_id =.*/secure_id = $sid/g" /etc/xdg/canonical-certification.conf
16+ fi
17+}
18+
19+
20 SID_Check(){
21 name="Secure ID Check"
22 echoname
23 #if [ -n $secureid ];then
24 if grep "^secure_id =" /etc/xdg/canonical-certification.conf >/dev/null ; then
25 secureid=$(grep "^secure_id =" /etc/xdg/canonical-certification.conf|awk '{print $3}')
26- echo " secure_id is configured as $secureid"
27- eval info${i}=\"$secureid\"
28+ echo " Secure ID is configured as '$secureid'."
29+ echo " Is this correct? [Y/n]"
30+ read -s -N1 a
31+ if [[ $a == "n" || $a == "N" ]]; then
32+ configure_SID
33+ SID_Check
34+ else
35+ eval info${i}=\"$secureid\"
36 info
37+ fi
38 else
39 echo -e " secure_id is not configured.\n Would you like to configure it now? [Y/n]"
40 read -s -N1 a
41 if [[ $a == "Y" || $a == "y" || -z $a ]]; then
42- read -e -p " Please enter the secure_id of your SUT: " sid
43- sudo sed -i "s/#\[transport:c3\]/\[transport:c3\]/g" /etc/xdg/canonical-certification.conf
44- sudo sed -i "s/#secure_id =.*/secure_id = $sid/g" /etc/xdg/canonical-certification.conf
45+ configure_SID
46 SID_Check
47 elif [[ $a == "N" || $a == "n" ]]; then
48 eval info${i}=\"Not Set\"

Subscribers

People subscribed via source and target branches