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

[cmds] Add env vars to /etc/sashrc, use HOSTNAME env var in getty not /etc/hostname #2072

Merged
merged 1 commit into from
Oct 14, 2024
Merged
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
4 changes: 4 additions & 0 deletions elkscmd/rootfs_template/etc/sashrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# init file for sash
setenv TERM ansi
setenv USER root
setenv HOME /root
setenv SHELL /bin/sash
setenv TZ GMT0
setenv HISTORY 30
setenv HISTPAGE 20
14 changes: 9 additions & 5 deletions elkscmd/sys_utils/getty.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ void consolemsg(const char *str, ...)
}


#ifndef SUPER_SMALL
char Host[256], *Date = 0, *Time = 0;

#if UNUSED
char Host[256];
void host(void) {
char *ptr;
int fp = open(_PATH_HOSTNAME,O_RDONLY), sz;
Expand All @@ -113,6 +112,10 @@ void host(void) {
if (!*Host)
strcpy( Host, "LocalHost" );
}
#endif

#ifndef SUPER_SMALL
char *Date, *Time;

/* Before = "Sun Dec 25 12:34:56 7890"
* Columns = "0....:....1....:....2..."
Expand Down Expand Up @@ -296,7 +299,6 @@ int main(int argc, char **argv)
write(1,Buffer,n);
#else
when();
host();
*Buffer = '\0';
while (read(fd,Buffer,1) > 0) {
ch = *Buffer;
Expand Down Expand Up @@ -359,7 +361,9 @@ int main(int argc, char **argv)
state(Date);
break;
case 'H': /* Host */
state(Host);
if (!(ptr = getenv("HOSTNAME")))
ptr = "LocalHost";
state(ptr);
break;
case 'L': /* Line used */
ptr = rindex(argv[1],'/');
Expand Down
Loading