openwrt-packages/utils/byobu/patches/100-check-if-bashrc-exists....

30 lines
1.3 KiB
Diff

--- a/usr/bin/byobu-disable-prompt.in
+++ b/usr/bin/byobu-disable-prompt.in
@@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+[ -w "$HOME/.bashrc" ] || exit 1
+
PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="@prefix@" || export BYOBU_PREFIX
--- a/usr/bin/byobu-janitor.in
+++ b/usr/bin/byobu-janitor.in
@@ -112,6 +112,7 @@ killall -u $USER byobu-statusd >/dev/nul
rm -f "$FLAG" "/var/run/screen/S-$USER/$PKG.reload-required"
# Affects: Upgrades from <= byobu 5.50, install byobu prompt if using stock bashrc
+if [ -r /etc/skel/.bashrc ] && [ -r "$HOME/.bashrc" ] && [ -w "$HOME/.bashrc" ]; then
if ! (grep -qs "#byobu-prompt#$" "$HOME/.bashrc") && ! [ -e "$BYOBU_CONFIG_DIR/prompt" ]; then
if eval $BYOBU_TEST diff >/dev/null 2>&1; then
if diff /etc/skel/.bashrc "$HOME/.bashrc" >/dev/null 2>&1; then
@@ -123,6 +124,7 @@ if ! (grep -qs "#byobu-prompt#$" "$HOME/
fi
fi
fi
+fi
[ -r "$BYOBU_CONFIG_DIR/prompt" ] || printf "[ -r ${BYOBU_PREFIX}/share/${PKG}/profiles/bashrc ] && . ${BYOBU_PREFIX}/share/${PKG}/profiles/bashrc #byobu-prompt#\n" > "$BYOBU_CONFIG_DIR/prompt"
# Affects: Upgrades from <= byobu 5.126, clear out ec2/rcs cost statuses