OSDN Git Service

more iroot
authorpaperbenni <paperbenni@gmail.com>
Sun, 7 Jun 2020 18:06:51 +0000 (20:06 +0200)
committerpaperbenni <paperbenni@gmail.com>
Sun, 7 Jun 2020 18:06:51 +0000 (20:06 +0200)
ask.sh
askdisk.sh
askutils.sh
depend/depend.sh
iroot.sh
systeminstall.sh

diff --git a/ask.sh b/ask.sh
index f54e5b0..7b21d94 100755 (executable)
--- a/ask.sh
+++ b/ask.sh
@@ -68,7 +68,7 @@ this will delete all existing data" | imenu -C; then
         NEWHOSTNAME=$(imenu -i "enter name of this computer")
     done
 
-    echo "$NEWHOSTNAME" >/root/instantARCH/config/hostname
+    iroot hostname "$NEWHOSTNAME"
 
     wallstatus install
     SUMMARY="Installation Summary:"
index 57e81f2..de5ae93 100644 (file)
@@ -55,7 +55,7 @@ The Bootloader requires
         cfdisk "$DISK"
     fi
 
-    echo "$DISK" >/root/instantARCH/config/disk
+    iroot disk "$DISK"
     startchoice
 }
 
@@ -95,6 +95,7 @@ erase partition to start fresh' | imenu -l)" in
         touch /root/instantARCH/config/erasehome
         ;;
     esac
+    iroot parthome "$HOMEPART"
     echo "$HOMEPART" >/root/instantARCH/config/parthome
 
 }
index d610620..be2a548 100755 (executable)
@@ -3,7 +3,6 @@
 # User questions are seperated into functions to be reused in alternative installers
 # like topinstall.sh
 
-
 # check if the install session is GUI or cli
 guimode() {
     if [ -e /opt/noguimode ]; then
@@ -42,6 +41,7 @@ asklayout() {
             if [ -z "$OTHERKEY" ]; then
                 unset NEWKEY
             else
+                # newline is intentional!!!
                 echo "
 $OTHERKEY" >/root/instantARCH/data/lang/keyboard/other
             fi
@@ -52,8 +52,7 @@ $OTHERKEY" >/root/instantARCH/data/lang/keyboard/other
     if [ "${NEWKEY}" = "forcequit" ]; then
         exit 1
     fi
-
-    echo "$NEWKEY" >/root/instantARCH/config/keyboard
+    iroot keyboard "$NEWKEY"
 }
 
 # ask for default locale
@@ -62,7 +61,7 @@ asklocale() {
     while [ -z "$NEWLOCALE" ]; do
         NEWLOCALE="$(ls | imenu -l 'Select language> ')"
     done
-    echo "$NEWLOCALE" >/root/instantARCH/config/locale
+    iroot locale "$NEWLOCALE"
 
 }
 
@@ -80,8 +79,7 @@ askregion() {
         done
     fi
 
-    echo "$REGION" >/root/instantARCH/config/region
-    [ -n "$CITY" ] && echo "$CITY" >/root/instantARCH/config/city
+    [ -n "$CITY" ] && iroot city "$CITY"
 
 }
 
@@ -105,13 +103,13 @@ This could prevent the system from booting" | imenu -C; then
         done
 
         if grep -qi "dkms" <<<"$DRIVERCHOICE"; then
-            echo "dkms" >/root/instantARCH/config/graphics
+            iroot graphics "dkms"
         elif grep -qi "nvidia" <<<"$DRIVERCHOICE"; then
-            echo "nvidia" >/root/instantARCH/config/graphics
+            iroot graphics "nvidia"
         elif grep -qi "open" <<<"$DRIVERCHOICE"; then
-            echo "open" >/root/instantARCH/config/graphics
+            iroot graphics "open"
         elif [ -z "$DRIVERCHOICE" ]; then
-            echo "nodriver" >/root/instantARCH/config/graphics
+            iroot graphics "nodriver"
         fi
 
     else
@@ -138,7 +136,7 @@ askuser() {
         NEWPASS2="$(imenu -P 'confirm password')"
     done
 
-    echo "$NEWUSER" >/root/instantARCH/config/user
-    echo "$NEWPASS" >/root/instantARCH/config/password
+    iroot user "$NEWUSER"
+    iroot user "$NEWPASS"
 
 }
index 7a493cd..44a6f9d 100755 (executable)
@@ -59,5 +59,5 @@ if [ -e /usr/share/liveutils ]; then
 fi
 
 # installer variables utility
-curl -s https://raw.githubusercontent.com/instantOS/instantARCH/master/iroot.sh >/usr/bin/iroot
+cat /root/instantARCH/iroot.sh >/usr/bin/iroot
 chmod 755 /usr/bin/iroot
index a3d9663..6651a58 100644 (file)
--- a/iroot.sh
+++ b/iroot.sh
@@ -4,8 +4,18 @@
 
 IROOT="/root/instantARCH/config"
 
+if [ -z "$1" ]; then
+    echo "usage: 
+set value:    iroot field value
+get value:    iroot field
+remove/stdin: iroot r/i field"
+    exit
+fi
+
 if [ "$1" = "i" ]; then
     cat /dev/stdin >"$IROOT/$2"
+elif [ "$1" = "r" ]; then
+    [ -e "$IROOT/$2" ] && rm "$IROOT/$2"
 elif [ -n "$2" ]; then
     echo "$2" >"$IROOT/$1"
 else
index b8fa8e4..595e9a8 100755 (executable)
@@ -25,7 +25,7 @@ chrootscript "lang/locale" "setting locale"
 [ -e /opt/noerror ] && rm /opt/noerror
 
 # make instantOS packages optional
-if ! [ -e /root/instantARCH/config/onlyarch ] &&
+if iroot onlyarch &&
     ! [ -e /opt/onlyarch ]; then
     chrootscript "instantos/install" "configuring instantOS, this will take a while"
     if grep -iq 'manjaro' /etc/os-release; then