Skip to content
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

[Bug's PR]: Creating the extra function, to preserve reverting the custom config of Polybar into the example config of Polybar. #22278

Closed
wants to merge 1 commit into from
Closed
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
25 changes: 25 additions & 0 deletions x11-packages/polybar/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,28 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="-DENABLE_I3=ON"
termux_step_pre_configure() {
LDFLAGS+=" -landroid-glob"
}

termux_step_extra() {
local PREFIX_LOCAL="/data/data/com.termux/files/usr/"
local HOME_LOCAL="$(find /data/data/com.termux/files -type d -iname 'home*')"
local HOME_CACHE="${HOME_LOCAL}/.cache"
local POLYBAR_BACKUP_DIR="${HOME_LOCAL}/.backup/polybar"

if [[ ! -f ${HOME_CACHE}/termux ]]; then
$(printf "${SHELL}\n" | sed -E "s|${PREFIX_LOCAL}/bin/||") -c "mkdir --parent --verbose --mode=755 $HOME/.cache/termux"
fi

if [[ ! -f ${POLYBAR_BACKUP_DIR} ]]; then
$(printf "${SHELL}\n" | sed -E "s|${PREFIX_LOCAL}/bin/||") -c "mkdir --parent --verbose --mode=755 $HOME/.backup/polybar" | tee -a ${HOME_CACHE}/termux/polyCreate.log
fi

if [[ -f ${PREFIX_LOCAL}/etc/polybar/config.ini ]]; then
if [[ -f ${POLYBAR_BACKUP_DIR} ]]; then
rm --recursive --force --preserve-root --verbose ${POLYBAR_BACKUP_DIR} | tee -a ${HOME_CACHE}/termux/polybar-config-remove.log
fi

mv --verbose ${PREFIX_LOCAL}/etc/polybar/config.ini ${POLYBAR_BACKUP_DIR} | sed -E "s|renamed|moved and renamed|g"
rm --recursive --force --preserve-root --verbose ${PREFIX_LOCAL}/etc/config.ini
cp --recursive --force --verbose ${POLYBAR_BACKUP_DIR} ${PREFIX_LOCAL}/etc/polybar/config.ini
fi
}