فهرست منبع

Allow running the script without sudo

Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
Dorian Stoll 5 سال پیش
والد
کامیت
47209a7772
1فایلهای تغییر یافته به همراه10 افزوده شده و 10 حذف شده
  1. 10 10
      setup.sh

+ 10 - 10
setup.sh

@@ -39,17 +39,17 @@ ask() {
 
 
 echo "==> Copying the config files under root to where they belong..."
 echo "==> Copying the config files under root to where they belong..."
 for dir in $(ls root/); do
 for dir in $(ls root/); do
-    cp -Rbv "root/$dir/"* "/$dir/"
+    sudo cp -Rbv "root/$dir/"* "/$dir/"
 done
 done
 
 
 echo "==> Copying firmware files under root..."
 echo "==> Copying firmware files under root..."
-cp -rv firmware/* /lib/firmware/
+sudo cp -rv firmware/* /lib/firmware/
 
 
 echo "==> Making /lib/systemd/system-sleep/sleep executable..."
 echo "==> Making /lib/systemd/system-sleep/sleep executable..."
-chmod -v a+x /lib/systemd/system-sleep/sleep
+sudo chmod -v a+x /lib/systemd/system-sleep/sleep
 
 
 echo "==> Enabling power management for Surface Go touchscreen..."
 echo "==> Enabling power management for Surface Go touchscreen..."
-systemctl enable -q surfacego-touchscreen
+sudo systemctl enable -q surfacego-touchscreen
 
 
 echo
 echo
 
 
@@ -65,8 +65,8 @@ if ask "Do you want to replace suspend with hibernate?" N; then
         LIB="/lib"
         LIB="/lib"
     fi
     fi
 
 
-    ln -vsfb $LIB/systemd/system/hibernate.target /etc/systemd/system/suspend.target
-    ln -vsfb $LIB/systemd/system/systemd-hibernate.service /etc/systemd/system/systemd-suspend.service
+    sudo ln -vsfb $LIB/systemd/system/hibernate.target /etc/systemd/system/suspend.target
+    sudo ln -vsfb $LIB/systemd/system/systemd-hibernate.service /etc/systemd/system/systemd-suspend.service
 else
 else
     echo "==> Not touching Suspend"
     echo "==> Not touching Suspend"
 fi
 fi
@@ -76,8 +76,8 @@ echo
 echo "Setting your clock to local time can fix issues with Windows dualboot."
 echo "Setting your clock to local time can fix issues with Windows dualboot."
 if ask "Do you want to set your clock to local time instead of UTC?" N; then
 if ask "Do you want to set your clock to local time instead of UTC?" N; then
     echo "==> Setting clock to local time..."
     echo "==> Setting clock to local time..."
-    timedatectl set-local-rtc 1
-    hwclock --systohc --localtime
+    sudo timedatectl set-local-rtc 1
+    sudo hwclock --systohc --localtime
 else
 else
     echo "==> Not setting clock..."
     echo "==> Not setting clock..."
 fi
 fi
@@ -100,7 +100,7 @@ if ask "Do you want to install the patched libwacom?" Y; then
 
 
     echo "==> Installing latest libwacom-surface..."
     echo "==> Installing latest libwacom-surface..."
 
 
-    dpkg -i tmp/*.deb
+    sudo dpkg -i tmp/*.deb
     rm -rf tmp
     rm -rf tmp
 else
 else
     echo "==> Not touching libwacom"
     echo "==> Not touching libwacom"
@@ -122,7 +122,7 @@ if ask "Do you want to download and install the latest kernel?" Y; then
     echo
     echo
     echo "==> Installing latest kernel..."
     echo "==> Installing latest kernel..."
 
 
-    dpkg -i tmp/*.deb
+    sudo dpkg -i tmp/*.deb
     rm -rf tmp
     rm -rf tmp
 else
 else
     echo "==> Not downloading latest kernel"
     echo "==> Not downloading latest kernel"