From 1eab389030ae0107cd5af56a32da3f77d0d90760 Mon Sep 17 00:00:00 2001 From: Tomasz Swierczek Date: Thu, 1 Feb 2024 13:28:10 +0100 Subject: [PATCH] Fix sqlite2 DB operations during the build & small spellchek fix Now, if inserting certificates into DB fails, the shell script that manages their insertion will cause GBS build to fail too. Without this change, on Tizen 7.0+ the certs databse of cert-svc was emtpy, becasue sqlite3 couldn't parse the sql script adding each certificate AND GBS didn't fail due to the way sh script was written. Change-Id: I6a0266936b317a119dbe08fd3817883ab1b2fcec --- etc/db/CMakeLists.txt | 4 ++-- etc/db/initialize_store_db.sh | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/etc/db/CMakeLists.txt b/etc/db/CMakeLists.txt index daa819b..74c116d 100644 --- a/etc/db/CMakeLists.txt +++ b/etc/db/CMakeLists.txt @@ -28,7 +28,7 @@ EXECUTE_PROCESS( ) IF (${CURRENT_DIGEST} STREQUAL ${CA_BUNDLE_DIGEST}) - MESSAGE("ca-certificate digest is match with static db.") + MESSAGE("ca-certificate digest matches with static db.") INSTALL(FILES resource/certs-meta-0.0.4.db @@ -37,7 +37,7 @@ IF (${CURRENT_DIGEST} STREQUAL ${CA_BUNDLE_DIGEST}) ) ELSE (${CURRENT_DIGEST} STREQUAL ${CA_BUNDLE_DIGEST}) - MESSAGE("${CURRENT_DIGEST} digest is not match with static db.") + MESSAGE("${CURRENT_DIGEST} digest does not match with static db.") MESSAGE("Add ssl table to certs-meta.db") EXECUTE_PROCESS( diff --git a/etc/db/initialize_store_db.sh b/etc/db/initialize_store_db.sh index 3d1fd63..918a553 100755 --- a/etc/db/initialize_store_db.sh +++ b/etc/db/initialize_store_db.sh @@ -54,12 +54,10 @@ function initialize_store_data() subject_hash=`openssl x509 -in $fname -subject_hash -noout` subject_hash_old=`openssl x509 -in $fname -subject_hash_old -noout` common_name=`get_common_name $fname` - - echo "INSERT INTO ssl \ - (gname, certificate, file_hash, subject_hash, \ - common_name, enabled, is_root_app_enabled) VALUES \ - (\"$gname\", \"$cert\", \"$subject_hash\", \"$subject_hash_old\", \ - \"$common_name\", 1, 1);" >> $ROOT_CERT_SQL + echo "INSERT INTO ssl (gname, certificate, file_hash, subject_hash,\ +common_name, enabled, is_root_app_enabled) VALUES\ +('$gname', '$cert', '$subject_hash', '$subject_hash_old','$common_name', \ +1, 1);" >> $ROOT_CERT_SQL done echo "END TRANSACTION;" >> $ROOT_CERT_SQL } @@ -69,6 +67,4 @@ touch $ROOT_CERT_SQL initialize_store_version initialize_store_data -cat $ROOT_CERT_SQL | sqlite3 $DB_PATH - -rm $ROOT_CERT_SQL +sqlite3 $DB_PATH ".read $ROOT_CERT_SQL" && rm $ROOT_CERT_SQL -- 2.7.4