Skip to content

Commit

Permalink
github testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Hiepler committed Sep 2, 2023
1 parent 187cf1c commit 9e95a12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
15 changes: 11 additions & 4 deletions bootstrap-plugins/dist
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ function rpi_dist_cp_image() {

# create directory?
[[ -d "${distdir}" ]] || {
verbose " creating dir: ${distdir}"
sudo mkdir -p "${distdir}" || error "mkdir ${distdir}"
rpi_chmod_pi "0770" "${RPI_IMG_DISTDIR}" || error "rpi_chmod_pi"
rpi_chown_pi "${RPI_IMG_DISTDIR}" || error "rpi_chown_pi"
Expand All @@ -149,8 +150,9 @@ function rpi_dist_cp_image() {
if [[ -d "${RPI_USER_DISTDIR}/${path}" ]] || [[ -d "${RPI_DISTDIR}/${path}" ]] ; then
# create dst path
[[ -d "${distdir}/${path}" ]] || {
verbose " creating dir: ${distdir}/${path}"
sudo mkdir -p "${distdir}/${path}/" || error "mkdir"
rpi_chown_pi "${RPI_IMG_DISTDIR}/${path}" || error "rpi_chown_pi"
rpi_chown_pi "${RPI_IMG_DISTDIR}/${path}/" || error "rpi_chown_pi"
}
# copy to image (from project distdir)
[[ -d "${RPI_DISTDIR}/${path}" ]] && {
Expand All @@ -168,14 +170,19 @@ function rpi_dist_cp_image() {
else
# create dst path
[[ -d "${distdir}/$(dirname "${path}")" ]] || {
verbose " creating dir: ${distdir}/$(dirname "${path}")"
sudo mkdir -p "${distdir}/$(dirname "${path}")" || error "mkdir"
rpi_chown_pi "${RPI_IMG_DISTDIR}/$(dirname "${path}")" || error "rpi_chown_pi"
}
# copy to image
# copy to image distdir from project distdir
[[ -f "${RPI_DISTDIR}/${path}" ]] && {
sudo cp -r "${RPI_DISTDIR}/${path}" "${distdir}/$(dirname "${path}")/" || error "cp"
verbose "cp ${RPI_DISTDIR}/${path} ${distdir}/$(dirname "${path}")/"
sudo cp "${RPI_DISTDIR}/${path}" "${distdir}/$(dirname "${path}")/" || error "cp"
}
# copy to image distdir from user distdir
[[ -f "${RPI_USER_DISTDIR}/${path}" ]] && {
sudo cp -r "${RPI_USER_DISTDIR}/${path}" "${distdir}/$(dirname "${path}")/" || error "cp"
verbose "cp ${RPI_USER_DISTDIR}/${path}" "${distdir}/$(dirname "${path}")/"
sudo cp "${RPI_USER_DISTDIR}/${path}" "${distdir}/$(dirname "${path}")/" || error "cp"
}
# register copy command
run_on "${phase}" "sudo cp \"${RPI_IMG_DISTDIR}/${path}\" \"/$(dirname "${path}")/\"" || error "run_on"
Expand Down
10 changes: 0 additions & 10 deletions test/dist.bats
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ teardown() {
@test "plugin_prerun dist" {
RPI_DIST_COPY_ON_BAKE=""
RPI_DIST_COPY_ON_LOGIN=""
RPI_DIST_COPY_ON_LOGIN_ONCE=""
RPI_DIST_COPY_ON_BOOT=""
RPI_DIST_COPY_ON_BOOT_ONCE=""
run plugin_prerun dist
assert_failure
}
Expand All @@ -60,18 +58,14 @@ teardown() {
# on bake: check if dir contents are copied
RPI_DIST_COPY_ON_BAKE="/home/pi"
RPI_DIST_COPY_ON_BOOT=""
RPI_DIST_COPY_ON_BOOT_ONCE=""
RPI_DIST_COPY_LOGIN=""
RPI_DIST_COPY_ON_LOGIN_ONCE=""
plugin_run dist
[ -f "${RPI_ROOT}/home/pi/foo" ]
[ -f "${RPI_ROOT}/home/pi/bar" ]
# on boot: check if dir is copied to image and copy command is added
RPI_DIST_COPY_ON_BOOT="/home/pi"
RPI_DIST_COPY_ON_BOOT_ONCE=""
RPI_DIST_COPY_ON_BAKE=""
RPI_DIST_COPY_LOGIN=""
RPI_DIST_COPY_ON_LOGIN_ONCE=""
plugin_run dist
[ -f "${RPI_ROOT}/${RPI_IMG_DISTDIR}/home/pi/foo" ]
[ -f "${RPI_ROOT}/${RPI_IMG_DISTDIR}/home/pi/bar" ]
Expand All @@ -82,16 +76,12 @@ teardown() {
# on bake: check if file is copied
RPI_DIST_COPY_ON_BAKE="/etc/issue"
RPI_DIST_COPY_ON_BOOT=""
RPI_DIST_COPY_ON_BOOT_ONCE=""
RPI_DIST_COPY_LOGIN=""
RPI_DIST_COPY_ON_LOGIN_ONCE=""
plugin_run dist
[ -f "${RPI_ROOT}/etc/issue" ]
RPI_DIST_COPY_ON_BAKE=""
RPI_DIST_COPY_ON_BOOT="/etc/issue"
RPI_DIST_COPY_ON_BOOT_ONCE=""
RPI_DIST_COPY_LOGIN=""
RPI_DIST_COPY_ON_LOGIN_ONCE=""
plugin_run dist
[ -f "${RPI_ROOT}/${RPI_IMG_DISTDIR}/etc/issue" ]
grep --quiet 'sudo cp "/var/lib/bootstrap-dist//etc/issue"' "${RPI_ROOT}/home/pi/.bootstrap_run_on_first_boot"
Expand Down

0 comments on commit 9e95a12

Please sign in to comment.