From b29a505085cdee262f5f8807bac5a6f7b66fd53d Mon Sep 17 00:00:00 2001 From: Roarde Date: Thu, 5 Nov 2020 00:58:31 +0000 Subject: [PATCH] heirloom-sh: allow Heirloom-specific profiles (patch) --- srcpkgs/heirloom-sh/files/system-profile | 6 ++ srcpkgs/heirloom-sh/files/user-profile | 6 ++ ...rloom-specific-profiles-manpage-incl.patch | 97 +++++++++++++++++++ .../allow-heirloom-specific-profiles.patch | 59 +++++++++++ srcpkgs/heirloom-sh/patches/series | 1 + srcpkgs/heirloom-sh/template | 9 +- 6 files changed, 175 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/heirloom-sh/files/system-profile create mode 100644 srcpkgs/heirloom-sh/files/user-profile create mode 100644 srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles-manpage-incl.patch create mode 100644 srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles.patch create mode 100644 srcpkgs/heirloom-sh/patches/series diff --git a/srcpkgs/heirloom-sh/files/system-profile b/srcpkgs/heirloom-sh/files/system-profile new file mode 100644 index 00000000000..1437ad47af6 --- /dev/null +++ b/srcpkgs/heirloom-sh/files/system-profile @@ -0,0 +1,6 @@ +# /etc/heirloom/profile + +# If this file is present, it is read in place of /etc/profile. A +# ~/.heirloom_profile will take the place of ~/.profile. Otherwise, +# initialization is as stated under "Invocation" in heirloom_sh(1). +echo Sourcing /etc/heirloom/profile. diff --git a/srcpkgs/heirloom-sh/files/user-profile b/srcpkgs/heirloom-sh/files/user-profile new file mode 100644 index 00000000000..8858cfbd1db --- /dev/null +++ b/srcpkgs/heirloom-sh/files/user-profile @@ -0,0 +1,6 @@ +# $HOME/.heirloom_profile + +# If this file is present, it is read in place of ~/.profile. Also, an +# /etc/heirloom/profile can take the place of /etc/profile. Otherwise, +# initialization is as stated under "Invocation" in heirloom_sh(1). +echo Sourcing ${HOME}/heirloom_profile. diff --git a/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles-manpage-incl.patch b/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles-manpage-incl.patch new file mode 100644 index 00000000000..9b322cb0b74 --- /dev/null +++ b/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles-manpage-incl.patch @@ -0,0 +1,97 @@ +From: Roarde +Date: Mon 02 Nov 2020 08:41:40 AM UTC +Subject: [heirloom-sh] Allow Heirloom-specific profiles + +If /etc/heirloom/profile exists, read it instead of /etc/profile; same +for an ~/.heirloom_profile and ~/.profile. + +_____ + +diff -u ./defs.h ../new/defs.h +--- ./defs.h 2005-07-03 19:25:46.000000000 +0000 ++++ ../new/defs.h 2020-10-30 19:13:00.980629847 +0000 +@@ -461,7 +461,9 @@ + /* prompting */ + extern const char stdprompt[]; + extern const char supprompt[]; ++extern const char hlprofile[]; + extern const char profile[]; ++extern const char syscfgdirs[]; + extern const char sysprofile[]; + + /* built in names */ +Common subdirectories: ./fakewchar and ../new/fakewchar +diff -u ./main.c ../new/main.c +--- ./main.c 2005-07-03 19:25:46.000000000 +0000 ++++ ../new/main.c 2020-10-30 19:55:43.016599989 +0000 +@@ -268,14 +268,14 @@ + + #ifndef RES + +- if ((input = pathopen(nullstr, sysprofile)) >= 0) ++ if ((input = pathopen(syscfgdirs, sysprofile)) >= 0) + exfile(rflag); /* file exists */ + + #endif + /* user profile */ + +- if ((input = pathopen(homenod.namval, profile)) >= 0) +- { ++ if ((input = pathopen(homenod.namval, hlprofile)) >= 0 || ++ (input = pathopen(homenod.namval, profile)) >= 0) { + exfile(rflag); + flags &= ~ttyflg; + } +diff -u ./msg.c ../new/msg.c +--- ./msg.c 2005-07-03 19:25:46.000000000 +0000 ++++ ../new/msg.c 2020-10-30 19:16:40.050891092 +0000 +@@ -151,8 +151,10 @@ + const char readmsg[] = "> "; + const char stdprompt[] = "$ "; + const char supprompt[] = "# "; ++const char hlprofile[] = ".heirloom_profile"; + const char profile[] = ".profile"; +-const char sysprofile[] = "/etc/profile"; ++const char syscfgdirs[] = "/etc/heirloom:/etc"; ++const char sysprofile[] = "profile"; + + /* + * tables +diff -u ./sh.1 ../new/sh.1 +--- ./sh.1 2005-07-03 16:43:18.000000000 +0000 ++++ ../new/sh.1 2020-11-02 06:08:36.273336949 +0000 +@@ -1442,12 +1442,17 @@ + .SS "Invocation" + If the first character of argument zero is + .BR \- , +-commands are read from ++commands are read from the first of ++.B /etc/heirloom/profile ++or + .B /etc/profile +-and +-.BR \s-1$HOME\s0/.\|profile , +-if the respective file exists. ++which exists, if either, and then likewise from ++.B \s-1$HOME\s0/.\|heirloom_profile ++or ++.BR \s-1$HOME\s0/.\|profile . + Commands are then read as described below. ++.PD ++.PP + The following flags are interpreted by the shell + when it is invoked. + .PD 0 +@@ -1595,8 +1600,12 @@ + .I wait + command (see above) recognizes job ids in its arguments. + .SH FILES ++/etc/heirloom/profile ++.br + /etc/profile + .br ++.RB $HOME/ . \^heirloom_profile ++.br + .RB $HOME/ . \^profile + .br + /tmp/sh* diff --git a/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles.patch b/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles.patch new file mode 100644 index 00000000000..e95488c91c3 --- /dev/null +++ b/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles.patch @@ -0,0 +1,59 @@ +From: Roarde +Date: Wed 04 Nov 2020 07:08:58 AM UTC +Subject: [heirloom-sh] Allow Heirloom-specific profiles + +If /etc/heirloom/profile exists, read it instead of /etc/profile; same +for an ~/.heirloom_profile and ~/.profile. + +_____ + +diff -u ./defs.h ../new/defs.h +--- ./defs.h 2005-07-03 19:25:46.000000000 +0000 ++++ ../new/defs.h 2020-10-30 19:13:00.980629847 +0000 +@@ -461,7 +461,9 @@ + /* prompting */ + extern const char stdprompt[]; + extern const char supprompt[]; ++extern const char hlprofile[]; + extern const char profile[]; ++extern const char syscfgdirs[]; + extern const char sysprofile[]; + + /* built in names */ +Common subdirectories: ./fakewchar and ../new/fakewchar +diff -u ./main.c ../new/main.c +--- ./main.c 2005-07-03 19:25:46.000000000 +0000 ++++ ../new/main.c 2020-10-30 19:55:43.016599989 +0000 +@@ -268,14 +268,14 @@ + + #ifndef RES + +- if ((input = pathopen(nullstr, sysprofile)) >= 0) ++ if ((input = pathopen(syscfgdirs, sysprofile)) >= 0) + exfile(rflag); /* file exists */ + + #endif + /* user profile */ + +- if ((input = pathopen(homenod.namval, profile)) >= 0) +- { ++ if ((input = pathopen(homenod.namval, hlprofile)) >= 0 || ++ (input = pathopen(homenod.namval, profile)) >= 0) { + exfile(rflag); + flags &= ~ttyflg; + } +diff -u ./msg.c ../new/msg.c +--- ./msg.c 2005-07-03 19:25:46.000000000 +0000 ++++ ../new/msg.c 2020-10-30 19:16:40.050891092 +0000 +@@ -151,8 +151,10 @@ + const char readmsg[] = "> "; + const char stdprompt[] = "$ "; + const char supprompt[] = "# "; ++const char hlprofile[] = ".heirloom_profile"; + const char profile[] = ".profile"; +-const char sysprofile[] = "/etc/profile"; ++const char syscfgdirs[] = "/etc/heirloom:/etc"; ++const char sysprofile[] = "profile"; + + /* + * tables diff --git a/srcpkgs/heirloom-sh/patches/series b/srcpkgs/heirloom-sh/patches/series new file mode 100644 index 00000000000..f6dd605b872 --- /dev/null +++ b/srcpkgs/heirloom-sh/patches/series @@ -0,0 +1 @@ +allow-heirloom-specific-profiles.patch diff --git a/srcpkgs/heirloom-sh/template b/srcpkgs/heirloom-sh/template index 3f62628668d..97769216642 100644 --- a/srcpkgs/heirloom-sh/template +++ b/srcpkgs/heirloom-sh/template @@ -1,14 +1,15 @@ # Template file for 'heirloom-sh' pkgname=heirloom-sh version=050706 -revision=4 +revision=5 short_desc="A portable variant of the traditional Unix shell" maintainer="allan " -license="Caldera" +license="CDDL-1.0, Caldera" homepage="http://heirloom.sourceforge.net/sh.html" distfiles="${SOURCEFORGE_SITE}/heirloom/${pkgname}/${version}/${pkgname}-${version}.tar.bz2" checksum=25fb8409e1eb75bb5da21ca32baf2d5eebcb8b84a1288d66e65763a125809e1d -register_shell="/bin/heirloom-sh" +conf_files="/etc/heirloom/profile /etc/skel/.heirloom_profile" +register_shell="/usr/bin/heirloom-sh /bin/heirloom-sh" do_build() { make CC=$CC CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ${makejobs} @@ -18,4 +19,6 @@ do_install() { vman sh.1.out heirloom-sh.1 vlicense CALDERA.LICENSE vlicense OPENSOLARIS.LICENSE + vinstall ${FILESDIR}/system-profile 0644 etc/heirloom profile + vinstall ${FILESDIR}/user-profile 0644 etc/skel .heirloom_profile }