diff --git a/README.md b/README.md index 39aec3437..ef4374b65 100644 --- a/README.md +++ b/README.md @@ -85,12 +85,12 @@ If you want to compile the kernel yourself (e.g. if your distribution is not sup * If you are getting stuck at boot when loading the ramdisk, you need to install the Processor Microcode Firmware for Intel CPUs (usually found under Additional Drivers in Software and Updates). * Do not install TLP! It can cause slowdowns, laggy performance, and occasional hangs! You have been warned. -* If you chose to use hibernate over suspend, please follow the instructions [here][hibernate-setup]. +* If you want to use hibernate instead of suspend, you need to create a swap partition or file, please follow your distribution's instructions (or [here][hibernate-setup]). ### Support If you have questions or need support, please use our [Gitter Community][gitter]! -For development related questions and discussions, please consider joining our IRC channel on freenode (`freenode/##linux-surface`). +For development related questions and discussions, please consider joining our IRC channel on freenode (`freenode/##linux-surface`) or the [equivalent Matrix bridge](https://matrix.to/#/#freenode_##linux-surface:matrix.org). [wiki-setup]: https://github.com/linux-surface/linux-surface/wiki/Installation-and-Setup [wiki-setup-post]: https://github.com/linux-surface/linux-surface/wiki/Installation-and-Setup#post-installation @@ -103,5 +103,6 @@ For development related questions and discussions, please consider joining our I [gitter]: https://gitter.im/linux-surface [hibernate-setup]: https://fitzcarraldoblog.wordpress.com/2018/07/14/configuring-lubuntu-18-04-to-enable-hibernation-using-a-swap-file +[releases]: https://github.com/linux-surface/linux-surface/releases [linux-surface-kernel]: https://github.com/linux-surface/kernel/ diff --git a/root/etc/NetworkManager/NetworkManager.conf b/root/etc/NetworkManager/NetworkManager.conf deleted file mode 100644 index efbd970a6..000000000 --- a/root/etc/NetworkManager/NetworkManager.conf +++ /dev/null @@ -1,12 +0,0 @@ -[main] -plugins=ifupdown,keyfile,ofono -#dns=dnsmasq - -[ifupdown] -managed=false - -[connection] -wifi.powersave = 2 - -[device] -wifi.scan-rand-mac-address=false diff --git a/root/etc/NetworkManager/conf.d/99-surface.conf b/root/etc/NetworkManager/conf.d/99-surface.conf new file mode 100644 index 000000000..c34a6825c --- /dev/null +++ b/root/etc/NetworkManager/conf.d/99-surface.conf @@ -0,0 +1,5 @@ +[connection] +wifi.powersave = 2 + +[device] +wifi.scan-rand-mac-address=false diff --git a/root/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf b/root/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf deleted file mode 100644 index 111af0beb..000000000 --- a/root/etc/NetworkManager/conf.d/default-wifi-powersave-on.conf +++ /dev/null @@ -1,2 +0,0 @@ -[connection] -wifi.powersave = 2 diff --git a/root/etc/X11/xorg.conf.d/20-intel_example.conf b/root/etc/X11/xorg.conf.d/20-intel_example.conf deleted file mode 100644 index 5b74960c8..000000000 --- a/root/etc/X11/xorg.conf.d/20-intel_example.conf +++ /dev/null @@ -1,7 +0,0 @@ -#Section "Device" -# Identifier "Intel Graphics" -# Driver "intel" -# Option "TripleBuffer" "true" -# Option "TearFree" "true" -# Option "DRI" "true" -#EndSection diff --git a/root/etc/initramfs-tools/modules b/root/etc/initramfs-tools/modules deleted file mode 100644 index 78e7f6421..000000000 --- a/root/etc/initramfs-tools/modules +++ /dev/null @@ -1,21 +0,0 @@ -# List of modules that you want to include in your initramfs. -# They will be loaded at boot time in the order below. -# -# Syntax: module_name [args ...] -# -# You must run update-initramfs(8) to effect this change. -# -# Examples: -# -# raid1 -# sd_mod -hid -hid_sensor_hub -i2c_hid -hid_generic -usbhid -hid_multitouch -intel_ipts -surface_sam_ssh -surface_sam_san -surface_sam_vhf diff --git a/root/etc/modprobe.d/snd-hda-intel.conf b/root/etc/modprobe.d/snd-hda-intel.conf deleted file mode 100644 index adc9bf976..000000000 --- a/root/etc/modprobe.d/snd-hda-intel.conf +++ /dev/null @@ -1,3 +0,0 @@ -options snd-hda-intel single_cmd=1 -options snd-hda-intel probe_mask=1 -options snd-hda-intel model=basic diff --git a/root/etc/modprobe.d/soc-button-array.conf b/root/etc/modprobe.d/soc-button-array.conf deleted file mode 100644 index 70dae580d..000000000 --- a/root/etc/modprobe.d/soc-button-array.conf +++ /dev/null @@ -1 +0,0 @@ -softdep soc_button_array pre: pinctrl_sunrisepoint diff --git a/root/etc/pulse/daemon_example.conf b/root/etc/pulse/daemon_example.conf deleted file mode 100644 index b2e57e3a3..000000000 --- a/root/etc/pulse/daemon_example.conf +++ /dev/null @@ -1,86 +0,0 @@ -# This file is part of PulseAudio. -# -# PulseAudio is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# PulseAudio is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with PulseAudio; if not, see . - -## Configuration file for the PulseAudio daemon. See pulse-daemon.conf(5) for -## more information. Default values are commented out. Use either ; or # for -## commenting. - -; daemonize = no -; fail = yes -; allow-module-loading = yes -; allow-exit = yes -; use-pid-file = yes -; system-instance = no -; local-server-type = user -; enable-shm = yes -; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB -; lock-memory = no -; cpu-limit = no - -; high-priority = yes -; nice-level = -11 - -; realtime-scheduling = yes -; realtime-priority = 5 - -; exit-idle-time = 20 -; scache-idle-time = 20 - -; dl-search-path = (depends on architecture) - -; load-default-script-file = yes -; default-script-file = /etc/pulse/default.pa - -; log-target = auto -; log-level = notice -; log-meta = no -; log-time = no -; log-backtrace = 0 - -resample-method = speex-float-3 -; enable-remixing = yes -; enable-lfe-remixing = yes -; lfe-crossover-freq = 120 - -flat-volumes = no - -; rlimit-fsize = -1 -; rlimit-data = -1 -; rlimit-stack = -1 -; rlimit-core = -1 -; rlimit-as = -1 -; rlimit-rss = -1 -; rlimit-nproc = -1 -; rlimit-nofile = 256 -; rlimit-memlock = -1 -; rlimit-locks = -1 -; rlimit-sigpending = -1 -; rlimit-msgqueue = -1 -; rlimit-nice = 31 -; rlimit-rtprio = 9 -; rlimit-rttime = 200000 - -default-sample-format = s24le -default-sample-rate = 44100 -; alternate-sample-rate = 48000 -; default-sample-channels = 2 -; default-channel-map = front-left,front-right - -; default-fragments = 4 -; default-fragment-size-msec = 25 - -; enable-deferred-volume = yes -; deferred-volume-safety-margin-usec = 1 -; deferred-volume-extra-delay-usec = 0 diff --git a/root/etc/pulse/default_example.pa b/root/etc/pulse/default_example.pa deleted file mode 100644 index 9478d6615..000000000 --- a/root/etc/pulse/default_example.pa +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/pulseaudio -nF -# -# This file is part of PulseAudio. -# -# PulseAudio is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# PulseAudio is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with PulseAudio; if not, see . - -# This startup script is used only if PulseAudio is started per-user -# (i.e. not in system mode) - -.fail - -### Automatically restore the volume of streams and devices -load-module module-device-restore -load-module module-stream-restore -load-module module-card-restore - -### Automatically augment property information from .desktop files -### stored in /usr/share/application -load-module module-augment-properties - -### Should be after module-*-restore but before module-*-detect -load-module module-switch-on-port-available - -### Use hot-plugged devices like Bluetooth or USB automatically (LP: #1702794) -.ifexists module-switch-on-connect.so -load-module module-switch-on-connect -.endif - -### Load audio drivers statically -### (it's probably better to not load these drivers manually, but instead -### use module-udev-detect -- see below -- for doing this automatically) -#load-module module-alsa-sink -#load-module module-alsa-source device=hw:1,0 -#load-module module-oss device="/dev/dsp" sink_name=output source_name=input -#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input -#load-module module-null-sink -#load-module module-pipe-sink - -### Automatically load driver modules depending on the hardware available -.ifexists module-udev-detect.so -load-module module-udev-detect tsched=0 -.else -### Use the static hardware detection module (for systems that lack udev support) -load-module module-detect -.endif - -### Automatically connect sink and source if JACK server is present -.ifexists module-jackdbus-detect.so -.nofail -load-module module-jackdbus-detect channels=2 -.fail -.endif - -### Automatically load driver modules for Bluetooth hardware -.ifexists module-bluetooth-policy.so -load-module module-bluetooth-policy -.endif - -.ifexists module-bluetooth-discover.so -load-module module-bluetooth-discover -.endif - -### Load several protocols -.ifexists module-esound-protocol-unix.so -load-module module-esound-protocol-unix -.endif -load-module module-native-protocol-unix - -### Network access (may be configured with paprefs, so leave this commented -### here if you plan to use paprefs) -#load-module module-esound-protocol-tcp -#load-module module-native-protocol-tcp -#load-module module-zeroconf-publish - -### Load the RTP receiver module (also configured via paprefs, see above) -#load-module module-rtp-recv - -### Load the RTP sender module (also configured via paprefs, see above) -#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'" -#load-module module-rtp-send source=rtp.monitor - -### Load additional modules from GConf settings. This can be configured with the paprefs tool. -### Please keep in mind that the modules configured by paprefs might conflict with manually -### loaded modules. -.ifexists module-gconf.so -.nofail -load-module module-gconf -.fail -.endif - -### Automatically restore the default sink/source when changed by the user -### during runtime -### NOTE: This should be loaded as early as possible so that subsequent modules -### that look up the default sink/source get the right value -load-module module-default-device-restore - -### Automatically move streams to the default sink if the sink they are -### connected to dies, similar for sources -load-module module-rescue-streams - -### Make sure we always have a sink around, even if it is a null sink. -load-module module-always-sink - -### Honour intended role device property -load-module module-intended-roles - -### Automatically suspend sinks/sources that become idle for too long -load-module module-suspend-on-idle - -### If autoexit on idle is enabled we want to make sure we only quit -### when no local session needs us anymore. -.ifexists module-console-kit.so -load-module module-console-kit -.endif -.ifexists module-systemd-login.so -load-module module-systemd-login -.endif - -### Enable positioned event sounds -load-module module-position-event-sounds - -### Cork music/video streams when a phone stream is active -load-module module-role-cork - -### Modules to allow autoloading of filters (such as echo cancellation) -### on demand. module-filter-heuristics tries to determine what filters -### make sense, and module-filter-apply does the heavy-lifting of -### loading modules and rerouting streams. -load-module module-filter-heuristics -load-module module-filter-apply - -### Make some devices default -#set-default-sink output -#set-default-source input diff --git a/root/etc/systemd/logind.conf b/root/etc/systemd/logind.conf deleted file mode 100644 index 6dece08fb..000000000 --- a/root/etc/systemd/logind.conf +++ /dev/null @@ -1,36 +0,0 @@ -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. -# -# Entries in this file show the compile time defaults. -# You can change settings by editing this file. -# Defaults can be restored by simply deleting this file. -# -# See logind.conf(5) for details. - -[Login] -#NAutoVTs=6 -#ReserveVT=6 -#KillUserProcesses=no -#KillOnlyUsers= -#KillExcludeUsers=root -#InhibitDelayMaxSec=5 -#HandlePowerKey=poweroff -#HandleSuspendKey=suspend -#HandleHibernateKey=hibernate -#HandleLidSwitch=suspend -#HandleLidSwitchDocked=ignore -#PowerKeyIgnoreInhibited=no -#SuspendKeyIgnoreInhibited=no -#HibernateKeyIgnoreInhibited=no -#LidSwitchIgnoreInhibited=yes -#HoldoffTimeoutSec=30s -#IdleAction=ignore -#IdleActionSec=30min -#RuntimeDirectorySize=10% -#RemoveIPC=yes -#UserTasksMax=12288 -HandleLidSwitch=suspend diff --git a/root/etc/systemd/sleep.conf b/root/etc/systemd/sleep.conf deleted file mode 100644 index 1532c56b5..000000000 --- a/root/etc/systemd/sleep.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Sleep] -SuspendState=freeze diff --git a/root/etc/systemd/system/surfacego-touchscreen.service b/root/etc/systemd/system/surfacego-touchscreen.service new file mode 100644 index 000000000..60bebb2d0 --- /dev/null +++ b/root/etc/systemd/system/surfacego-touchscreen.service @@ -0,0 +1,11 @@ +[Unit] +Description=Surface Go Touchscreen Power Management + +[Service] +Type=oneshot +RemainAfterExit=yes +ConditionPathExists=/sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/power/control +Exec=/bin/sh -c "echo on > /sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/power/control" + +[Install] +WantedBy=multi-user.target diff --git a/root/etc/udev/rules.d/98-keyboardscovers.rules b/root/etc/udev/rules.d/99-surface.rules similarity index 100% rename from root/etc/udev/rules.d/98-keyboardscovers.rules rename to root/etc/udev/rules.d/99-surface.rules diff --git a/root/etc/udev/rules.d/99-touchscreens.rules b/root/etc/udev/rules.d/99-touchscreens.rules deleted file mode 100644 index f5c8f0c64..000000000 --- a/root/etc/udev/rules.d/99-touchscreens.rules +++ /dev/null @@ -1,47 +0,0 @@ -# NTRG Touchscreen (SP3) -SUBSYSTEMS=="input", ATTRS{name}=="NTRG0001:01 1B96:1B05 Touchscreen", ENV{ID_INPUT_TOUCHSCREEN}="1", SYMLINK+="input/touchscreen" - -# NTRG Pen (SP3) -SUBSYSTEMS=="input", ATTRS{name}=="NTRG0001:01 1B96:1B05 Pen", SYMLINK+="input/pen" - -# Touchscreen (SG) -SUBSYSTEMS=="input", ATTRS{name}=="04F3:261A Touchscreen", ENV{ID_INPUT_TOUCHSCREEN}="1", SYMLINK+="input/touchscreen" - -# Pen (SG) -SUBSYSTEMS=="input", ATTRS{name}=="04F3:261A Pen", SYMLINK+="input/pen" - -# IPTS Touchscreen (SP4) -SUBSYSTEMS=="input", ATTRS{name}=="ipts 1B96:006A Touchscreen", ENV{ID_INPUT_TOUCHSCREEN}="1", SYMLINK+="input/touchscreen" - -# IPTS Pen (SP4) -SUBSYSTEMS=="input", ATTRS{name}=="ipts 1B96:006A Pen", SYMLINK+="input/pen" - -# IPTS Touchscreen (SP2017) -SUBSYSTEMS=="input", ATTRS{name}=="ipts 1B96:001F Touchscreen", ENV{ID_INPUT_TOUCHSCREEN}="1", SYMLINK+="input/touchscreen" - -# IPTS Pen (SP2017) -SUBSYSTEMS=="input", ATTRS{name}=="ipts 1B96:001F Pen", SYMLINK+="input/pen" - -# IPTS Touchscreen (SP6) -SUBSYSTEMS=="input", ATTRS{name}=="ipts 045E:001F Touchscreen", ENV{ID_INPUT_TOUCHSCREEN}="1", SYMLINK+="input/touchscreen" - -# IPTS Pen (SP6) -SUBSYSTEMS=="input", ATTRS{name}=="ipts 045E:001F Pen", SYMLINK+="input/pen" - -# IPTS Touchscreen (SB) -SUBSYSTEMS=="input", ATTRS{name}=="ipts 1B96:005E Touchscreen", ENV{ID_INPUT_TOUCHSCREEN}="1", SYMLINK+="input/touchscreen" - -# IPTS Pen (SB) -SUBSYSTEMS=="input", ATTRS{name}=="ipts 1B96:005E Pen", SYMLINK+="input/pen" - -# IPTS Touchscreen (SB2 15") -SUBSYSTEMS=="input", ATTRS{name}=="ipts 045E:0020 Touchscreen", ENV{ID_INPUT_TOUCHSCREEN}="1", SYMLINK+="input/touchscreen" - -# IPTS Pen (SB2 15") -SUBSYSTEMS=="input", ATTRS{name}=="ipts 045E:0020 Pen", SYMLINK+="input/pen" - -# IPTS Touchscreen (SB2 13") -SUBSYSTEMS=="input", ATTRS{name}=="ipts 045E:0021 Touchscreen", ENV{ID_INPUT_TOUCHSCREEN}="1", SYMLINK+="input/touchscreen" - -# IPTS Pen (SB2 13") -SUBSYSTEMS=="input", ATTRS{name}=="ipts 045E:0021 Pen", SYMLINK+="input/pen" diff --git a/root/lib/systemd/system-sleep/sleep b/root/lib/systemd/system-sleep/sleep old mode 100644 new mode 100755 index 23315fd5d..c950631c9 --- a/root/lib/systemd/system-sleep/sleep +++ b/root/lib/systemd/system-sleep/sleep @@ -1,4 +1,5 @@ -#!/bin/bash +#!/bin/sh + case $1 in pre) # unload the modules before going to sleep @@ -8,55 +9,44 @@ case $1 in fi ## Disable bluetooth regardless if devices are connected (see notes below) - #if ps cax | grep bluetoothd; then - # bluetoothctl power off - #fi - - # handle wifi issues - modprobe -r mwifiex_pcie; - modprobe -r mwifiex; - modprobe -r cfg80211; + # if ps cax | grep bluetoothd; then + # bluetoothctl power off + # fi ## IPTS: see notes below ## > Remove IPTS from ME side - #modprobe -r ipts_surface - #modprobe -r intel_ipts - #modprobe -r mei_hdcp - #modprobe -r mei_me - #modprobe -r mei + # modprobe -r ipts_surface + # modprobe -r intel_ipts + # modprobe -r mei_hdcp + # modprobe -r mei_me + # modprobe -r mei ## > Remove IPTS from i915 side - #for i in $(find /sys/kernel/debug/dri -name i915_intel_ipts_cleanup); do echo 1 > $i; done + # for i in $(find /sys/kernel/debug/dri -name i915_intel_ipts_cleanup); do + # echo 1 > $i + # done ;; post) # re-load modules after resume ## IPTS: see notes below ## > Load IPTS from i915 side - #for i in $(find /sys/kernel/debug/dri -name i915_intel_ipts_init); do echo 1 > $i; done + # for i in $(find /sys/kernel/debug/dri -name i915_intel_ipts_init); do + # echo 1 > $i + # done ## > Load IPTS from ME side - #modprobe mei - #modprobe mei_me - #modprobe mei_hdcp - #modprobe intel_ipts - #modprobe ipts_surface + # modprobe mei + # modprobe mei_me + # modprobe mei_hdcp + # modprobe intel_ipts + # modprobe ipts_surface # Restart bluetooth if ps cax | grep bluetoothd; then bluetoothctl power on fi - - # handle wifi issues: complete cycle - modprobe cfg80211; - modprobe mwifiex; - modprobe mwifiex_pcie; - echo 1 > /sys/bus/pci/rescan - - if [ -x "$(command -v nmcli)" ] && [ "$(nmcli net)" = "enabled" ]; then - nmcli net off - nmcli net on - fi ;; esac # Notes: +# # - For IPTS, see # > https://github.com/jakeday/linux-surface/issues/544#issuecomment-519126757 # for an explanation/discussion. We do not unload/reload modules for now as @@ -64,6 +54,7 @@ esac # experience any issues on suspend/resume, please file an appropriate issue or # join the discussion linked above so that we can fix it. As a temporary # workaround, you may want to uncomment the IPTS-related lines above. +# # - For bluetooth: If you have spontaneous wakeups, you may want to disable # bluetooth completely, regardless if any devices are connected or not, by # removing the `! bluetoothctl info;` part as indicated in the comment (e.g. diff --git a/setup.sh b/setup.sh index 6409c40f3..7fd8c9e30 100755 --- a/setup.sh +++ b/setup.sh @@ -1,71 +1,70 @@ -#!/bin/bash +#!/bin/sh -LX_BASE="" -LX_VERSION="" +# https://gist.github.com/davejamesmiller/1965569 +ask() { + local prompt default reply -if [ -r "/etc/os-release" ]; then - . "/etc/os-release" - if [ "$ID" = "arch" ]; then - LX_BASE="$ID" - elif [ "$ID" = "ubuntu" ]; then - LX_BASE="$ID" - LX_VERSION=$VERSION_ID - elif [ -n "$UBUNTU_CODENAME" ] ; then - LX_BASE="ubuntu" - LX_VERSION="$VERSION_ID" + if [ "${2:-}" = "Y" ]; then + prompt="Y/n" + default=Y + elif [ "${2:-}" = "N" ]; then + prompt="y/N" + default=N else - LX_BASE="$ID" - LX_VERSION="$VERSION" + prompt="y/n" + default= fi -else - echo "Could not identify your distro. Please open script and run commands manually." - exit -fi -SUR_MODEL="$(dmidecode | grep "Product Name" -m 1 | xargs | sed -e 's/Product Name: //g')" + while true; do -echo "Running $LX_BASE version $LX_VERSION on a $SUR_MODEL." -read -rp "Press enter if this is correct, or CTRL-C to cancel." tmp; echo -echo "Continuing setup..." + # Ask the question (not using "read -p" as it uses stderr not stdout) + echo -n "$1 [$prompt]: " + + # Read the answer (use /dev/tty in case stdin is redirected from somewhere else) + read reply Copying the config files under root to where they belong..." -for dir in $(ls root/); do cp -Rbv "root/$dir/"* "/$dir/"; done -echo +for dir in $(ls root/); do + sudo cp -Rbv "root/$dir/"* "/$dir/" +done echo "==> Copying firmware files under root..." -cp -rv firmware/* /lib/firmware/ +sudo cp -rv firmware/* /lib/firmware/ + +echo "==> Enabling power management for Surface Go touchscreen..." +sudo systemctl enable -q surfacego-touchscreen + echo -echo "==> Making /lib/systemd/system-sleep/sleep executable..." -chmod -v a+x /lib/systemd/system-sleep/sleep - -printf " -Suspend is recommended over hibernate. If you chose to use hibernate, please -make sure you've setup your swap file per the instructions in the README.\n\n" -read -rp "Do you want to replace suspend with hibernate? (type yes or no): " \ - usehibernate;echo - -if [ "$usehibernate" = "yes" ]; then - if [ "$LX_BASE" = "ubuntu" ] && [ 1 -eq "$(echo "${LX_VERSION} >= 17.10" | bc)" ]; then - echo "==> Using Hibernate instead of Suspend..." - 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 - echo "==> Using Hibernate instead of Suspend..." - ln -vsfb /usr/lib/systemd/system/hibernate.target /etc/systemd/system/suspend.target - sudo ln -vsfb /usr/lib/systemd/system/systemd-hibernate.service /etc/systemd/system/systemd-suspend.service - fi +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 + echo "==> Setting clock to local time..." + sudo timedatectl set-local-rtc 1 + sudo hwclock --systohc --localtime else - echo "==> Not touching Suspend" + echo "==> Not setting clock..." fi -printf " -Patched libwacom packages are available to better support the pen. If you -intend to use the pen, it's recommended that you install them!\n\n" -read -rp "Do you want to install the patched libwacom packages? (type yes or no): " \ - uselibwacom;echo +echo -if [ "$uselibwacom" = "yes" ]; then +echo "Patched libwacom packages are available to better support the pen." +echo "If you intend to use the pen, it's recommended that you install them!" + +if ask "Do you want to install the patched libwacom?" Y; then echo "==> Downloading latest libwacom-surface..." urls=$(curl --silent "https://api.github.com/repos/linux-surface/libwacom-surface-deb/releases/latest" \ @@ -78,73 +77,15 @@ if [ "$uselibwacom" = "yes" ]; then echo "==> Installing latest libwacom-surface..." - dpkg -i tmp/*.deb + sudo dpkg -i tmp/*.deb rm -rf tmp else echo "==> Not touching libwacom" fi -printf " -This repo comes with example xorg and pulse audio configs. If you chose to -keep them, be sure to rename them and uncomment out what you'd like to -keep!\n\n" -read -rp "Do you want to remove the example intel xorg config? (type yes or no): " \ - removexorg;echo - -if [ "$removexorg" = "yes" ]; then - echo "==> Removing the example intel xorg config..." - rm -v /etc/X11/xorg.conf.d/20-intel_example.conf -else - echo "==> Not touching example intel xorg config" \ - "(/etc/X11/xorg.conf.d/20-intel_example.conf)" -fi - echo -read -rp "Do you want to remove the example pulse audio config files? (type yes or no): "\ - removepulse;echo -if [ "$removepulse" = "yes" ]; then - echo "==> Removing the example pulse audio config files..." - rm -v /etc/pulse/daemon_example.conf - rm -v /etc/pulse/default_example.pa -else - echo "==> Not touching example pulse audio config files" \ - " (/etc/pulse/*_example.*)" -fi - -if [ "$SUR_MODEL" = "Surface Pro 3" ]; then - echo "==> Remove unneeded udev rules for Surface Pro 3..." - rm -v /etc/udev/rules.d/98-keyboardscovers.rules -fi - -if [ "$SUR_MODEL" = "Surface Go" ]; then - if [ ! -f "/etc/init.d/surfacego-touchscreen" ]; then - echo "==> Patching power control for Surface Go touchscreen..." - echo "echo \"on\" > /sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/power/control" \ - > /etc/init.d/surfacego-touchscreen - chmod -v 755 /etc/init.d/surfacego-touchscreen - update-rc.d surfacego-touchscreen defaults - fi -fi - -read -rp " -Do you want to set your clock to local time instead of UTC? This fixes -issues when dual booting with Windows. (type yes or no): " \ - uselocaltime;echo - -if [ "$uselocaltime" = "yes" ]; then - echo "==> Setting clock to local time..." - timedatectl set-local-rtc 1 - hwclock --systohc --localtime -else - echo "==> Not setting clock" -fi - -read -rp " -Do you want this script to download and install the latest kernel for you? -(type yes or no): " autoinstallkernel;echo - -if [ "$autoinstallkernel" = "yes" ]; then +if ask "Do you want to download and install the latest kernel?" Y; then echo "==> Downloading latest kernel..." urls=$(curl --silent "https://api.github.com/repos/linux-surface/linux-surface/releases/latest" \ @@ -158,11 +99,12 @@ if [ "$autoinstallkernel" = "yes" ]; then echo echo "==> Installing latest kernel..." - dpkg -i tmp/*.deb + sudo dpkg -i tmp/*.deb rm -rf tmp else echo "==> Not downloading latest kernel" fi echo + echo "All done! Please reboot."