Skip to content

Commit

Permalink
Create a symlink from /var/home to /home
Browse files Browse the repository at this point in the history
  • Loading branch information
muhdsalm committed Sep 1, 2024
1 parent 93d78b6 commit 47f75de
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion cmd/mount-sys.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ func mountSys(cmd *cobra.Command, _ []string) error {
os.Exit(8)
}

err = makeSymlinks(dryRun)
if err != nil {
cmdr.Error.Println(err)
os.Exit(9)
}

if dryRun {
cmdr.Info.Println("Dry run complete.")
} else {
Expand Down Expand Up @@ -157,7 +163,6 @@ func mountBindMounts(dryRun bool) error {
}

binds := []bindMount{
{"/var/home", "/home", 0},
{"/var/opt", "/opt", 0},
{"/.system/usr", "/.system/usr", syscall.MS_RDONLY},
}
Expand Down Expand Up @@ -203,6 +208,30 @@ func mountOverlayMounts(rootLabel string, dryRun bool) error {
return nil
}

func makeSymlinks(dryRun bool) error {
type symlink struct {
from string
to string
}

symlinks := []symlink{
{"/var/home", "/home"},
}

for _, symlink := range symlinks {
cmdr.FgDefault.Println("symliking " + symlink.from + " to " + symlink.to)
if !dryRun {
err := syscall.Symlink(symlink.from, symlink.to)
if err != nil {
return err
}
}
}

return nil

}

func adjustFstab(uuid string, dryRun bool) error {
cmdr.FgDefault.Println("switching the root in fstab")

Expand Down

0 comments on commit 47f75de

Please sign in to comment.