From e2540c49ad8fc6333e8a4b330d9a5ff0d6d713da Mon Sep 17 00:00:00 2001
From: Ribbon <ribbon_45@proton.me>
Date: Mon, 8 Jan 2024 18:51:42 +0000
Subject: [PATCH] Migrate the template scripts to /usr

---
 src/bin/cook.rs | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/bin/cook.rs b/src/bin/cook.rs
index 7a2c4edde..f1cf4c510 100644
--- a/src/bin/cook.rs
+++ b/src/bin/cook.rs
@@ -485,10 +485,10 @@ function cookbook_cargo_examples {
             --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
             --example "${example}" \
             --release
-        mkdir -pv "${COOKBOOK_STAGE}/bin"
+        mkdir -pv "${COOKBOOK_STAGE}/usr/bin"
         cp -v \
             "target/${TARGET}/release/examples/${example}" \
-            "${COOKBOOK_STAGE}/bin/${recipe}_${example}"
+            "${COOKBOOK_STAGE}/usr/bin/${recipe}_${example}"
     done
 }
 
@@ -501,10 +501,10 @@ function cookbook_cargo_packages {
             --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" \
             --package "${package}" \
             --release
-        mkdir -pv "${COOKBOOK_STAGE}/bin"
+        mkdir -pv "${COOKBOOK_STAGE}/usr/bin"
         cp -v \
             "target/${TARGET}/release/${package}" \
-            "${COOKBOOK_STAGE}/bin/${recipe}_${package}"
+            "${COOKBOOK_STAGE}/usr/bin/${recipe}_${package}"
     done
 }
 
@@ -532,12 +532,22 @@ then
     find "${COOKBOOK_STAGE}/bin" -type f -exec "${TARGET}-strip" -v {} ';'
 fi
 
+if [ -d "${COOKBOOK_STAGE}/usr/bin" ]
+then
+    find "${COOKBOOK_STAGE}/usr/bin" -type f -exec "${TARGET}-strip" -v {} ';'
+fi
+
 # Remove libtool files
 if [ -d "${COOKBOOK_STAGE}/lib" ]
 then
     find "${COOKBOOK_STAGE}/lib" -type f -name '*.la' -exec rm -fv {} ';'
 fi
 
+if [ -d "${COOKBOOK_STAGE}/usr/lib" ]
+then
+    find "${COOKBOOK_STAGE}/usr/lib" -type f -name '*.la' -exec rm -fv {} ';'
+fi
+
 # Remove cargo install files
 for file in .crates.toml .crates2.json
 do
-- 
GitLab