Skip to content

fix: replace pushd, popd with cd #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/libexec/rsdk/rsdk-build
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,18 @@ generate_image() {
chmod +x "$OUTPUT/build-image"
fi

pushd "$OUTPUT"
cd "$OUTPUT"
if [[ -f $RSDK_OPTION_ROOTFS ]]; then
./build-image
elif [[ -d $RSDK_OPTION_ROOTFS ]]; then
sudo ./build-image
sudo chown "$UID:${GID:-$UID}" "$RSDK_OPTION_IMAGE_NAME"
else
echo "Unrecognized rootfs type for '$RSDK_OPTION_ROOTFS'." >&2
popd
cd -
exit 1
fi
popd
cd -
}

main() {
Expand Down
20 changes: 10 additions & 10 deletions src/libexec/rsdk/rsdk-infra-update
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ update_repo() {

if [[ -e "$OUTPUT/.git" ]] && (cd "$OUTPUT" && [[ -n $(git remote) ]]); then
echo "Found existing repository. Updating..."
pushd "$OUTPUT"
cd "$OUTPUT"
if git remote show -n origin &>/dev/null; then
git fetch origin main
git pull origin main
fi
popd
cd -
else
rm -rf "$OUTPUT"
mkdir -p "$OUTPUT/.."
Expand All @@ -28,9 +28,9 @@ update_repo() {
if [[ $RSDK_OPTION_DRY_RUN == "true" ]]; then
echo "Dry run. Will only create local repo."
mkdir -p "$OUTPUT"
pushd "$OUTPUT"
cd "$OUTPUT"
git init
popd
cd -
else
if [[ $RSDK_OPTION_NO_CONFIRM == "true" ]]; then
echo "Target repository does not exist. New repository will be created."
Expand All @@ -41,9 +41,9 @@ update_repo() {
return 1
fi
fi
pushd "$OUTPUT/.."
cd "$OUTPUT/.."
gh repo create "$RSDK_TARGET_ORGANIZATION/$TARGET" --clone --public
popd
cd -
fi
NEW_REPO="true"
fi
Expand All @@ -65,9 +65,9 @@ update_repo() {
fi

echo "Prepare folder structure..."
pushd "$RSDK_GIT_REPO_TEMPLATE"
cd "$RSDK_GIT_REPO_TEMPLATE"
find . -mindepth 1 -type d -exec mkdir -p "$OUTPUT/{}" \;
popd
cd -

echo "Populate content..."
local RSDK_REV
Expand All @@ -88,7 +88,7 @@ update_repo() {
RSDK_REV="$RSDK_REV.dirty"
fi

pushd "$OUTPUT"
cd "$OUTPUT"
if [[ -n "$(git status --porcelain)" ]]; then
git add .
git commit --author "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" -m "chore: templates generated by RadxaOS-SDK/rsdk@$RSDK_REV"
Expand Down Expand Up @@ -120,7 +120,7 @@ update_repo() {
echo "Set repository homepage as '$homepage'."
echo "Set repository Pages build_type as 'workflow'."
fi
popd
cd -
}

main() {
Expand Down
4 changes: 2 additions & 2 deletions src/libexec/rsdk/rsdk-shell
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libexec里面的shebang指定了bash,不用改

Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ if [[ -n $DEVENV_NIX ]]; then
exit 1
fi

pushd "$PROJECT_DIR" || (
cd "$PROJECT_DIR" || (
echo "Unable to switch to project folder $PROJECT_DIR."
exit 1
)
devenv shell -- "$@"
RET="$?"
popd || (
cd - || (
echo "Unable to return to previous folder $OLD_DIR."
exit 1
)
Expand Down
4 changes: 2 additions & 2 deletions src/share/rsdk/build/mod/additional_repos.libjsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ function(suite, radxa_mirror, radxa_repo_suffix, product, temp_dir, install_vsco
set -e
mkdir -p "$1/srv/"
cp -R "%(temp_dir)s/debs/." "$1/srv/local-apt-repository"
pushd "$1/srv/local-apt-repository"
cd "$1/srv/local-apt-repository"
apt-ftparchive packages . > ./Packages
apt-ftparchive -o "APT::FTPArchive::Release::Origin=local-apt-repository" release . > ./Release
popd
cd -
echo "deb [trusted=yes] file://$1/srv/local-apt-repository ./" > "$1/etc/apt/sources.list.d/99-local-apt-repository.list"
cat << EOF > "$1/etc/apt/preferences.d/local-apt-repository"
Package: *
Expand Down
12 changes: 6 additions & 6 deletions src/share/rsdk/infra-repo/.github/workflows/build.yaml.jsonnet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workflow是在github上面运行的,不用改

Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ function(
# Workaround https://github.com/aptly-dev/aptly/issues/1297
git clone -b 1297-hack https://github.com/RadxaOS-SDK/aptly.git /tmp/aptly
export PATH="$HOME/go/bin:$PATH"
pushd /tmp/aptly
cd /tmp/aptly
make release
popd
cd -
APTLY_PATH=/tmp/aptly/xc-out/*/linux_amd64
export PATH="$APTLY_PATH:$PATH"

Expand All @@ -93,20 +93,20 @@ function(
"%(target)s"
)

pushd .infra-repo
cd .infra-repo

../src/bin/rsdk infra-pkg-download --no-default-distro "${suites[@]}"
../src/bin/rsdk infra-repo-sync --origin "${suites[0]}" --label "${suites[0]}" "${suites[@]}"
export RSDK_REPO_ORIGIN="${suites[0]}"

pushd "$HOME/.aptly/public/$RSDK_REPO_ORIGIN/"
cd "$HOME/.aptly/public/$RSDK_REPO_ORIGIN/"
cp "$OLDPWD/pkgs.json" ./
pandoc --from gfm --to html --standalone "$OLDPWD/README.md" --output index.html
find . > files.list
echo "pages=$(realpath .)" >> $GITHUB_OUTPUT
popd
cd -

popd
cd -
||| % {target: target},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function(
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}",
},
run: |||
pushd .infra-repo
cd .infra-repo
if [[ "${{ github.repository }}" != *-test ]] && \
wget "https://raw.githubusercontent.com/${{ github.repository }}-test/main/pkgs.lock" -O pkgs.lock.new; then
mv pkgs.lock.new pkgs.lock
Expand All @@ -77,16 +77,16 @@ function(
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git commit -m "chore: update package snapshot"
fi
popd
cd -
|||,
},
{
name: "Commit package snapshot",
shell: "bash",
run: |||
pushd .infra-repo
cd .infra-repo
git push
popd
cd -
|||,
},
],
Expand Down
Loading