Skip to content

Commit 1e7ef9d

Browse files
QwaSeeKadeepn
andauthored
fix(rootfs): unset GIT_FIXED_WORKDIR after debootstrap/mmdebstrap clone (#9132)
* fix(rootfs): pass GIT_FIXED_WORKDIR inline to fetch_from_repo Instead of using 'export GIT_FIXED_WORKDIR' and then 'unset' after, pass the variable inline to the fetch_from_repo call. This ensures the variable only exists in the context of that specific command and doesn't leak into subsequent calls. This follows the same pattern used in uboot-git.sh and kernel-git.sh. --------- Co-authored-by: Viacheslav Bocharov <[email protected]>
1 parent 810ff67 commit 1e7ef9d

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

lib/functions/rootfs/rootfs-create.sh

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,35 +100,38 @@ function create_new_rootfs_cache_via_debootstrap() {
100100
case "${DISTRIBUTION}" in
101101
Ubuntu)
102102
if [[ "${LEGACY_DEBOOTSTRAP,,}" == "yes" ]]; then
103-
export GIT_FIXED_WORKDIR="debootstrap-ubuntu-devel"
104-
fetch_from_repo "https://git.launchpad.net/ubuntu/+source/debootstrap" "debootstrap-ubuntu-devel" "tag:import/1.0.118ubuntu1.13"
105-
debootstrap_wanted_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}"
103+
declare debootstrap_name="debootstrap-ubuntu-devel"
104+
GIT_FIXED_WORKDIR="${debootstrap_name}" \
105+
fetch_from_repo "https://git.launchpad.net/ubuntu/+source/debootstrap" "${debootstrap_name}" "tag:import/1.0.118ubuntu1.13"
106+
debootstrap_wanted_dir="${SRC}/cache/sources/${debootstrap_name}"
106107
debootstrap_default_script="gutsy"
107108
debootstrap_version="$(sed 's/.*(\(.*\)).*/\1/; q' "${debootstrap_wanted_dir}/debian/changelog")"
108109
debootstrap_bin="${debootstrap_wanted_dir}/debootstrap"
109110
else
110-
export GIT_FIXED_WORKDIR="mmdebstrap-ubuntu-devel"
111+
declare debootstrap_name="mmdebstrap-ubuntu-devel"
111112
#FIXME: branch should be a variable eventually
112-
fetch_from_repo "https://git.launchpad.net/ubuntu/+source/mmdebstrap" "${GIT_FIXED_WORKDIR}" "branch:ubuntu/noble"
113-
debootstrap_wanted_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}"
113+
GIT_FIXED_WORKDIR="${debootstrap_name}" \
114+
fetch_from_repo "https://git.launchpad.net/ubuntu/+source/mmdebstrap" "${debootstrap_name}" "branch:ubuntu/noble"
115+
debootstrap_wanted_dir="${SRC}/cache/sources/${debootstrap_name}"
114116
debootstrap_version="$(sed 's/.*(\(.*\)).*/\1/; q' "${debootstrap_wanted_dir}/debian/changelog")"
115117
debootstrap_bin="${debootstrap_wanted_dir}/mmdebstrap"
116118
fi
117119
;;
118120
Debian)
119121
if [[ "${LEGACY_DEBOOTSTRAP,,}" == "yes" ]]; then
120-
export GIT_FIXED_WORKDIR="debootstrap-debian-devel"
121-
fetch_from_repo "https://salsa.debian.org/installer-team/debootstrap.git" "debootstrap-debian-devel" "branch:master"
122-
debootstrap_wanted_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}"
122+
declare debootstrap_name="debootstrap-debian-devel"
123+
GIT_FIXED_WORKDIR="${debootstrap_name}" \
124+
fetch_from_repo "https://salsa.debian.org/installer-team/debootstrap.git" "${debootstrap_name}" "branch:master"
125+
debootstrap_wanted_dir="${SRC}/cache/sources/${debootstrap_name}"
123126
debootstrap_default_script="sid"
124127
debootstrap_version="$(sed 's/.*(\(.*\)).*/\1/; q' "${debootstrap_wanted_dir}/debian/changelog")"
125128
debootstrap_bin="${debootstrap_wanted_dir}/debootstrap"
126129
else
127-
export GIT_FIXED_WORKDIR="mmdebstrap-debian-devel"
130+
declare debootstrap_name="mmdebstrap-debian-devel"
128131
#FIXME: branch should be a variable eventually
129-
fetch_from_repo "https://gitlab.mister-muffin.de/josch/mmdebstrap" "${GIT_FIXED_WORKDIR}" "branch:main"
130-
debootstrap_wanted_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}"
131-
debootstrap_default_script="sid"
132+
GIT_FIXED_WORKDIR="${debootstrap_name}" \
133+
fetch_from_repo "https://gitlab.mister-muffin.de/josch/mmdebstrap" "${debootstrap_name}" "branch:main"
134+
debootstrap_wanted_dir="${SRC}/cache/sources/${debootstrap_name}"
132135
debootstrap_version="$(sed 's/^## \[\([^]]*\)\].*/\1/; q' "${debootstrap_wanted_dir}/CHANGELOG.md")"
133136
debootstrap_bin="${debootstrap_wanted_dir}/mmdebstrap"
134137
fi

0 commit comments

Comments
 (0)