Add /var/cache, /var/log, and /var/run.

This commit is contained in:
Jonas 'Sortie' Termansen 2017-03-06 23:28:22 +01:00
parent 9d87d76957
commit 27f81b09a6
4 changed files with 34 additions and 6 deletions

View File

@ -130,7 +130,10 @@ sysroot-fsh:
mkdir -p "$(SYSROOT)/tix/manifest" mkdir -p "$(SYSROOT)/tix/manifest"
mkdir -p "$(SYSROOT)/tmp" -m 1777 mkdir -p "$(SYSROOT)/tmp" -m 1777
mkdir -p "$(SYSROOT)/var" mkdir -p "$(SYSROOT)/var"
mkdir -p "$(SYSROOT)/var/cache"
mkdir -p "$(SYSROOT)/var/empty" -m 555 mkdir -p "$(SYSROOT)/var/empty" -m 555
mkdir -p "$(SYSROOT)/var/log"
mkdir -p "$(SYSROOT)/var/run"
ln -sfT . "$(SYSROOT)/usr" ln -sfT . "$(SYSROOT)/usr"
.PHONY: sysroot-base-headers .PHONY: sysroot-base-headers
@ -160,7 +163,10 @@ sysroot-system: sysroot-fsh sysroot-base-headers
echo /tmp >> "$(SYSROOT)/tix/manifest/system" echo /tmp >> "$(SYSROOT)/tix/manifest/system"
echo /usr >> "$(SYSROOT)/tix/manifest/system" echo /usr >> "$(SYSROOT)/tix/manifest/system"
echo /var >> "$(SYSROOT)/tix/manifest/system" echo /var >> "$(SYSROOT)/tix/manifest/system"
echo /var/cache >> "$(SYSROOT)/tix/manifest/system"
echo /var/empty >> "$(SYSROOT)/tix/manifest/system" echo /var/empty >> "$(SYSROOT)/tix/manifest/system"
echo /var/log >> "$(SYSROOT)/tix/manifest/system"
echo /var/run >> "$(SYSROOT)/tix/manifest/system"
echo "$(HOST_MACHINE)" > "$(SYSROOT)/etc/machine" echo "$(HOST_MACHINE)" > "$(SYSROOT)/etc/machine"
echo /etc/machine >> "$(SYSROOT)/tix/manifest/system" echo /etc/machine >> "$(SYSROOT)/tix/manifest/system"
(echo 'NAME="Sortix"' && \ (echo 'NAME="Sortix"' && \

View File

@ -84,11 +84,20 @@ command line if it hasn't been password protected.
Likewise unprivileged users can use their own replacement bootloader by booting Likewise unprivileged users can use their own replacement bootloader by booting
a portable device under their control if the firmware configuration has not been a portable device under their control if the firmware configuration has not been
password protected. password protected.
.Ss Cleanup of /tmp .Ss Cleanup of /tmp and /var/run
.Nm .Nm
deletes everything inside of deletes everything inside of
.Pa /tmp .Pa /tmp
if it exists, otherwise it is created with mode 1777. if it exists, otherwise it is created with mode 1777.
.Pp
.Nm
creates
.Pa /var
with mode 755 if it doesn't exist.
.Nm
deletes everything inside of
.Pa /var/run
if it exists, otherwise it is created with mode 755.
.Ss Partition Creation .Ss Partition Creation
.Nm .Nm
will scan every block device for valid partition tables and create the will scan every block device for valid partition tables and create the

View File

@ -561,9 +561,8 @@ struct clean_tmp
int current_entry; int current_entry;
}; };
static void clean_tmp(void) static void clean_tmp(const char* tmp_path)
{ {
const char* tmp_path = "/tmp";
struct clean_tmp* state = calloc(1, sizeof(struct clean_tmp)); struct clean_tmp* state = calloc(1, sizeof(struct clean_tmp));
if ( !state ) if ( !state )
{ {
@ -680,7 +679,13 @@ static void init_early(void)
// Make sure that we have a /tmp directory. // Make sure that we have a /tmp directory.
umask(0000); umask(0000);
mkdir("/tmp", 01777); mkdir("/tmp", 01777);
clean_tmp(); clean_tmp("/tmp");
// Make sure that we have a /var/run directory.
umask(0000);
mkdir("/var", 0755);
mkdir("/var/run", 0755);
clean_tmp("/var/run");
// Set the default file creation mask. // Set the default file creation mask.
umask(0022); umask(0022);

View File

@ -45,11 +45,19 @@ delayed upgrades.
.It Pa /tix .It Pa /tix
Package management. Package management.
.It Pa /tmp .It Pa /tmp
Temporary files. Temporary files that is on boot.
.It Pa /usr .It Pa /usr
Symlink to the current directory. Symlink to the current directory.
.It Pa /var .It Pa /var
Various files. Variable data files.
.It Pa /var/cache
Cached application data that can be removed without data loss.
.It Pa /var/empty
Empty directory.
.It Pa /var/log
Log files.
.It Pa /var/run
Runtime program data that is cleaned on boot.
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr user-guide 7 .Xr user-guide 7