mirror of
https://github.com/rwinkhart/cachyos-postinstall-helper.git
synced 2026-09-06 00:57:20 -04:00
Third round of fixes
This commit is contained in:
+1
-2
@@ -10,7 +10,7 @@ import (
|
|||||||
func applications() {
|
func applications() {
|
||||||
for {
|
for {
|
||||||
var doAll bool
|
var doAll bool
|
||||||
choice := front.InputMenuGen("Application to install:", []string{"back", "all", "pamac-aur (replaces octopi)", "yay-bin (replaces paru)", "htop (replaces btop)", "neovim (replaces vi+vim+nano+micro)", "virt-manager (also installs qemu-desktop+libvirt)", "librewolf-bin", "zed", "steam"})
|
choice := front.InputMenuGen("Application to install:", []string{"back", "all", "pamac-aur", "yay-bin (replaces paru)", "htop (replaces btop)", "neovim (replaces vi+vim+nano+micro)", "virt-manager (also installs qemu-desktop+libvirt)", "librewolf-bin", "zed", "steam"})
|
||||||
switch choice {
|
switch choice {
|
||||||
case 1:
|
case 1:
|
||||||
return
|
return
|
||||||
@@ -19,7 +19,6 @@ func applications() {
|
|||||||
fallthrough
|
fallthrough
|
||||||
case 3:
|
case 3:
|
||||||
managePackage("-S", "pamac-aur")
|
managePackage("-S", "pamac-aur")
|
||||||
managePackage("-Rcns", "octopi")
|
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -21,8 +21,18 @@ func system() {
|
|||||||
doAll = true
|
doAll = true
|
||||||
fallthrough
|
fallthrough
|
||||||
case 3:
|
case 3:
|
||||||
|
err := os.RemoveAll("/tmp/custom-base-devel/")
|
||||||
|
if err != nil {
|
||||||
|
other.PrintError("Failed to remove /tmp/custom-base-devel", 1)
|
||||||
|
}
|
||||||
writeFile("/etc/doas.conf", "permit persist keepenv :wheel as root\n", "root", 0644)
|
writeFile("/etc/doas.conf", "permit persist keepenv :wheel as root\n", "root", 0644)
|
||||||
writeFile("/tmp/PKGBUILD", `pkgname=base-devel
|
err = os.MkdirAll("/tmp/custom-base-devel", 0777)
|
||||||
|
if err != nil {
|
||||||
|
other.PrintError("Failed to create /tmp/custom-base-devel/", 1)
|
||||||
|
}
|
||||||
|
uid := getUID()
|
||||||
|
err = os.Chown("/tmp/custom-base-devel", uid, uid)
|
||||||
|
writeFile("/tmp/custom-base-devel/PKGBUILD", `pkgname=base-devel
|
||||||
pkgver=1
|
pkgver=1
|
||||||
pkgrel=2
|
pkgrel=2
|
||||||
pkgdesc='Basic tools to build Arch Linux packages'
|
pkgdesc='Basic tools to build Arch Linux packages'
|
||||||
@@ -62,13 +72,18 @@ depends=(
|
|||||||
|
|
||||||
# vim: ts=2 sw=2 et:
|
# vim: ts=2 sw=2 et:
|
||||||
`, getUsername(), 0777)
|
`, getUsername(), 0777)
|
||||||
cmd := exec.Command("sudo", "-u", getUsername(), "makepkg", "-si", "--dir", "/tmp")
|
cmd := exec.Command("sudo", "-u", getUsername(), "makepkg", "--dir", "/tmp/custom-base-devel")
|
||||||
err := cmd.Run()
|
err = cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
other.PrintError("Failed to build+install custom base-devel", 1)
|
other.PrintError("Failed to build+install custom base-devel: "+err.Error(), 1)
|
||||||
}
|
}
|
||||||
|
managePackage("-U", "/tmp/custom-base-devel/base-devel-1-2-any.pkg.tar.xz")
|
||||||
managePackage("-S", "opendoas")
|
managePackage("-S", "opendoas")
|
||||||
managePackage("-R", "sudo")
|
cmd = exec.Command("pacman", "-R", "sudo", "qt-sudo", "octopi")
|
||||||
|
err = cmd.Run()
|
||||||
|
if err != nil {
|
||||||
|
other.PrintError("Failed to remove sudo", 1)
|
||||||
|
}
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
@@ -82,9 +97,9 @@ depends=(
|
|||||||
var sysctlConf strings.Builder
|
var sysctlConf strings.Builder
|
||||||
sysctlConf.WriteString("net.ipv6.conf.all.use_tempaddr = 2\nnet.ipv6.conf.default.use_tempaddr = 2")
|
sysctlConf.WriteString("net.ipv6.conf.all.use_tempaddr = 2\nnet.ipv6.conf.default.use_tempaddr = 2")
|
||||||
for _, nic := range nics {
|
for _, nic := range nics {
|
||||||
sysctlConf.WriteString("\nnet.ipv6.conf." + nic.Name() + "use_tempaddr = 2\n")
|
sysctlConf.WriteString("\nnet.ipv6.conf." + nic.Name() + ".use_tempaddr = 2")
|
||||||
}
|
}
|
||||||
writeFile("/etc/sysctl.d/40-ipv6-priv-ext.conf", sysctlConf.String(), "root", 0644)
|
writeFile("/etc/sysctl.d/40-ipv6-priv-ext.conf", sysctlConf.String()+"\n", "root", 0644)
|
||||||
|
|
||||||
if !doAll {
|
if !doAll {
|
||||||
break
|
break
|
||||||
|
|||||||
+13
-8
@@ -37,14 +37,7 @@ func writeFile(path, data, owner string, perms os.FileMode) {
|
|||||||
other.PrintError("Failed to write to "+path+":"+err.Error(), 1)
|
other.PrintError("Failed to write to "+path+":"+err.Error(), 1)
|
||||||
}
|
}
|
||||||
if owner != "root" {
|
if owner != "root" {
|
||||||
userInfo, err := user.Lookup(owner)
|
uid := getUID()
|
||||||
if err != nil {
|
|
||||||
other.PrintError("Failed to lookup UID for "+owner, 1)
|
|
||||||
}
|
|
||||||
uid, err := strconv.Atoi(userInfo.Uid)
|
|
||||||
if err != nil {
|
|
||||||
other.PrintError("Failed to convert UID to integer", 1)
|
|
||||||
}
|
|
||||||
err = os.Chown(path, uid, uid)
|
err = os.Chown(path, uid, uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
other.PrintError("Failed to set ownership of "+path, 1)
|
other.PrintError("Failed to set ownership of "+path, 1)
|
||||||
@@ -59,3 +52,15 @@ func getUsername() string {
|
|||||||
localUsername := username
|
localUsername := username
|
||||||
return localUsername
|
return localUsername
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getUID() int {
|
||||||
|
userInfo, err := user.Lookup(getUsername())
|
||||||
|
if err != nil {
|
||||||
|
other.PrintError("Failed to lookup UID for "+getUsername(), 1)
|
||||||
|
}
|
||||||
|
uid, err := strconv.Atoi(userInfo.Uid)
|
||||||
|
if err != nil {
|
||||||
|
other.PrintError("Failed to convert UID to integer", 1)
|
||||||
|
}
|
||||||
|
return uid
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user