Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Realease First Step #9

Merged
merged 30 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
77cb904
✨ Add charger rules
Thaylor-Hugo Mar 19, 2024
7ad7c0b
🚧 Start gnome shell support
Thaylor-Hugo Mar 19, 2024
30e11c7
♻️ Use gum on checklist
Thaylor-Hugo Mar 27, 2024
8359e3c
🚧 Start adding gum spin
Thaylor-Hugo Mar 27, 2024
138539d
⚡️ Apply gum spin to most installers
Thaylor-Hugo Mar 28, 2024
b31c07f
⚡️ Check if dependencies are already installed
Thaylor-Hugo Mar 28, 2024
278399c
🚸 gum on update and upgrade
Thaylor-Hugo Mar 28, 2024
f33aabf
🚚 Change directories organization
Thaylor-Hugo Mar 28, 2024
f18dff0
🚚 Move functions to different file
Thaylor-Hugo Mar 28, 2024
5fdbf88
🩹 Copy charge files instead of moving
Thaylor-Hugo Mar 28, 2024
ec15637
🚸 Gum to ros2
Thaylor-Hugo Mar 28, 2024
7773420
🩹 Fix ros config
Thaylor-Hugo Mar 28, 2024
ec802f5
✨ Gum to STM32Cube software
Thaylor-Hugo Mar 28, 2024
fe584fa
💄 Gum on git
Thaylor-Hugo Mar 28, 2024
c77fdc7
🚑 Fix dep install
Thaylor-Hugo Mar 28, 2024
0765a31
🚑 dep install fix 2
Thaylor-Hugo Mar 28, 2024
13d5471
⚰️ Remove v0 of config fish
Thaylor-Hugo Mar 28, 2024
ab4b8a4
💄 Gum on fish
Thaylor-Hugo Mar 28, 2024
41f2e91
⚰️ No need for fish to be last anymore
Thaylor-Hugo Mar 28, 2024
ad53e90
🔥 Remove fish source
Thaylor-Hugo Mar 28, 2024
32d3571
⚡️ Force stm remove
Thaylor-Hugo Mar 28, 2024
2d6d386
Merge pull request #6 from Thaylor-Hugo/feature/gum
Thaylor-Hugo Mar 28, 2024
4276efb
Merge branch 'develop' into feature/gnome-extensions
Thaylor-Hugo Mar 28, 2024
438c794
🍱 Update extensions list
Thaylor-Hugo Mar 28, 2024
2730cb8
✨ Feature Gnome Extension
Thaylor-Hugo Mar 28, 2024
39de3f7
🐛 Fix extension list variables
Thaylor-Hugo Mar 29, 2024
a91016f
🎨 Change order of installation
Thaylor-Hugo Mar 29, 2024
476ac3c
Merge pull request #8 from Thaylor-Hugo/feature/gnome-extensions
Thaylor-Hugo Mar 29, 2024
22c4a2a
📝 Update README
Thaylor-Hugo Mar 29, 2024
4d80c33
✏️ Fix typo on script name
Thaylor-Hugo Mar 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 51 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,58 @@
# First-Step
First step of a new operating system. Scripts for configurating the system in new installs
First step of a new operating system. Scripts for configuring the system in new installs

## Things you can install
## Dependencies
The script has some dependencies that are automatically installed. They are:
* [Gum](https://github.com/charmbracelet/gum) - A tool for glamorous shell scripts
* [Curl](https://curl.se/) - Command-line tool for transferring data with URL syntax
* [XClip](https://github.com/astrand/xclip) - Command line interface to X selections (clipboard)
* [Unzip]() - List, test and extract compressed files in a ZIP archive

* Programming Packages
* Git
* Fish
* GCC
* Make
* CMake
* VSCode
* ROS2
* JLink
* [STM32Cube programs](https://www.st.com/en/development-tools/stm32-software-development-tools.html)
* [ARM-GCC](https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2?rev=78196d3461ba4c9089a67b5f33edf82a&hash=5631ACEF1F8F237389F14B41566964EC)
## Things You Can Install

* Useful Packages
* Discord
* CopyQ
* Baobab
### Programming Packages

* [Git](https://git-scm.com/) - Version control system
* [Fish](https://fishshell.com/) - Interactive shell
* [GCC](https://gcc.gnu.org/) - GNU Compiler Collection
* [Make](https://www.gnu.org/software/make/) - Build tool
* [CMake](https://cmake.org/) - Build system generator
* [VSCode](https://code.visualstudio.com/) - Feature-rich code editor
* [ROS2](https://docs.ros.org/en/iron/index.html) - Robotics framework
* [JLink](https://www.segger.com/downloads/jlink/) - JLink tool
* [STM32Cube programs](https://www.st.com/en/development-tools/stm32-software-development-tools.html) - CubeProgrammer, CubeMX and CubeMonitor
* [ARM-GCC](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) - Compiler for ARM processors

### Useful Packages
* [Discord](https://discord.com/) - Communication platform
* [VLC](https://www.videolan.org/vlc/index.pt_BR.html) - Media player
* [CopyQ](https://hluk.github.io/CopyQ/) - Clipboard manager
* [Baobab](https://wiki.gnome.org/action/show/Apps/DiskUsageAnalyzer?action=show&redirect=Apps%2FBaobab) - Disk usage analyzer
* Charge Rules - Auto change power based on charging status

### Gnome Extensions
* [Battery Health Charging](https://extensions.gnome.org/extension/5724/battery-health-charging/) - Battery health and charging information
* [Blur My Shell](https://extensions.gnome.org/extension/3193/blur-my-shell/) - Blur the shell background and lock screen
* [Caffeine](https://extensions.gnome.org/extension/517/caffeine/) - Prevent the activation of the screensaver
* [Clipboard Indicator](https://extensions.gnome.org/extension/779/clipboard-indicator/) - Clipboard manager
* [Dash to Dock](https://extensions.gnome.org/extension/307/dash-to-dock/) - Move the dash out of the overview transforming it in a dock
* [Extension List](https://extensions.gnome.org/extension/3088/extension-list/) - Manage GNOME Shell extensions
* [GNOME 40 UI Improvements](https://extensions.gnome.org/extension/4158/gnome-40-ui-improvements/) - GNOME 40 UI Improvements
* [GSConnect](https://extensions.gnome.org/extension/1319/gsconnect/) - KDE Connect implementation for GNOME
* [Impatience](https://extensions.gnome.org/extension/277/impatience/) - Speed up the GNOME Shell animations
* [Net Speed Simplified](https://extensions.gnome.org/extension/3724/net-speed-simplified/) - Display the network speed
* [Order Gnome Shell Extensions](https://extensions.gnome.org/extension/2114/order-gnome-shell-extensions/) - Order Gnome Shell Extensions
* [Refresh WiFi Connections](https://extensions.gnome.org/extension/905/refresh-wifi-connections/) - Refresh WiFi Connections
* [Sound Output Device Chooser](https://extensions.gnome.org/extension/906/sound-output-device-chooser/) - Sound Output Device Chooser
* [User Themes](https://extensions.gnome.org/extension/19/user-themes/) - User Themes
* [Vitals](https://extensions.gnome.org/extension/1460/vitals/) - System monitoring
* [WinTile](https://extensions.gnome.org/extension/1723/wintile-windows-10-window-tiling-for-gnome/) - Windows 10 window tiling for GNOME

## STM32Cube Dependencies
Please download the STM softwares (CubeMX, CubeProgrammer and CubeMonitor) and place them on stm folder. For more information read [stm README](stm/README.md)

## How to Use
Just run the top level script "first_step.sh" on the project root directory
```bash
./first_step.sh
```
148 changes: 87 additions & 61 deletions first_step.sh
Original file line number Diff line number Diff line change
@@ -1,96 +1,122 @@
#!/bin/bash

#TODO: Can probably use the a global variable for gum spin

# Check if the user is root
if [ `whoami` == 'root' ]; then
echo "Please re-run without sudo command."
exit 1
fi

# Print with root for the user to enter the password only once
sudo echo "Initiating Install and Config"
# Clear with root for the user to enter the password only once
sudo clear
echo "Initiating Install and Config"

# Source the install file
source tools/install.sh

# Function to install the dependencies
install_dep() {
sudo apt-get install xclip -y >> log/install.log
sudo apt-get install curl -y >> log/install.log
sudo apt-get install dialog -y >> log/install.log
sudo apt-get install unzip -y >> log/install.log
}
source tools/utils.sh
source tools/gnome_extension_install.sh

# Define the checklist items
programing_list=( "Git" "Version control system" "off" \
"Fish" "Interactive shell" "off" \
"GCC" "GNU Compiler Collection" "off" \
"Make" "Build tool" "off" \
"CMake" "Build system generator" "off" \
"VSCode" "Feature-rich code editor" "off" \
"ROS2" "Robotics framework" "off" \
"JLink" "JLink tools" "off" \
"STM32Cube" "CubeProgrammer, CubeMX and CubeMonitor" "off"
"ARM-GCC" "Compiler for ARM processors." "off")

useful_list=( "Discord" "Communication platform" "off" \
"VLC" "Media player" "off" \
"CopyQ" "Clipboard manager" "off" \
"Baobab" "Disk usage analiser" "off")
programing_list=( "Git - Version control system" \
"Fish - Interactive shell" \
"GCC - GNU Compiler Collection" \
"Make - Build tool" \
"CMake - Build system generator" \
"VSCode - Feature-rich code editor" \
"ROS2 - Robotics framework" \
"JLink - JLink tools" \
"STM32Cube - CubeProgrammer, CubeMX and CubeMonitor" \
"ARM-GCC - Compiler for ARM processors")

useful_list=( "Discord - Communication platform" \
"VLC - Media player" \
"CopyQ - Clipboard manager" \
"Baobab - Disk usage analiser" \
"Charge Rules - Auto change power profile")

extensions_list=( "Battery Health Charging - Battery health and charging information" \
"Blur My Shell - Blur the shell background and lock screen" \
"Caffeine - Prevent the activation of the screensaver" \
"Clipboard Indicator - Clipboard manager" \
"Dash to Dock - Move the dash out of the overview transforming it in a dock" \
"Extension List - Manage GNOME Shell extensions" \
"GNOME 40 UI Improvements - GNOME 40 UI Improvements" \
"GSConnect - KDE Connect implementation for GNOME" \
"Impatience - Speed up the GNOME Shell animations" \
"Net Speed Simplified - Display the network speed" \
"Order Gnome Shell Extensions - Order Gnome Shell Extensions" \
"Refresh WiFi Connections - Refresh WiFi Connections" \
"Sound Output Device Chooser - Sound Output Device Chooser" \
"User Themes - User Themes" \
"Vitals - System monitoring" \
"WinTile - Windows 10 window tiling for GNOME")

# Function to display the checklist
# First argument is the title
# Second argument is the list of items
display_checklist() {
local title=$1
shift
local items=("$@")
dialog --clear --checklist "$title" 0 0 ${#items[@]} "${items[@]}" 2>&1 >/dev/tty
}
# Display the checklist for programming items
clear
gum style \
--foreground 212 --border-foreground 212 --border double \
--align center --width 50 --margin "1 2" --padding "2 4" \
"Install and Configure Programming Items" 'Choose the items you would like!'
local selected_programing_items=$(gum choose --no-limit "${programing_list[@]}")
check_cancel

# Function to check if the user canceled the operation
check_cancel() {
if [ $? -eq 1 ] || [ $? -eq 255 ]; then
clear
echo "Exiting..."
exit 0
fi
}
# Display the checklist for useful items
clear
gum style \
--foreground 212 --border-foreground 212 --border double \
--align center --width 50 --margin "1 2" --padding "2 4" \
"Install and Configure Useful Items" 'Choose the items you would like!'
local selected_useful_items=$(gum choose --no-limit "${useful_list[@]}")
check_cancel

# Create the log directory and file
create_log() {
mkdir -p log
touch log/install.log
echo "" > log/install.log
# Display the checklist for gnome extensions
clear
gum style \
--foreground 212 --border-foreground 212 --border double \
--align center --width 50 --margin "1 2" --padding "2 4" \
"Install and Configure Gnome Extensions" 'Choose the items you would like!'
selected_extensions=$(gum choose --no-limit "${extensions_list[@]}")

# Separate the selected items
local IFS=$'\n'
selected_programing_items=($selected_programing_items)
selected_useful_items=($selected_useful_items)
selected_extensions=($selected_extensions)

# Combine the selected items
choices=("${selected_programing_items[@]}" "${selected_useful_items[@]}")
}

# Main script
main() {
create_log
echo "Installing the dependencies..."
install_dep

selected_programing_items=$(display_checklist "Install and Configure Programming Items" "${programing_list[@]}")
check_cancel
selected_useful_items=$(display_checklist "Install and Configure Useful Items" "${useful_list[@]}")
check_cancel

all_selected_items=($selected_programing_items $selected_useful_items)
display_checklist

clear
echo "Installing and configuring the selected items..."
echo -e "This may take a while... \n"

# Install the selected items
install_packages "${all_selected_items[@]}"

# Update and upgrade the system
sudo apt-get update >> log/install.log
sudo apt-get upgrade -y >> log/install.log

echo "Installation Done! Please reboot to finish configuration"
read -p "Reboot now? (y) or (n)..."
install_packages "${choices[@]}"

# Install gnome extensions
install_gnome_extensions "${selected_extensions[@]}"

echo "Finishing..."
gum spin --spinner line --title "Updating system" -- sudo apt-get update >> log/install.log
echo "System updated!"
gum spin --spinner line --title "Upgrading system" -- sudo apt-get upgrade -y >> log/install.log
echo "System upgraded!"

echo -e "\nInstallation Done! Please reboot to finish configuration"
read -p "Reboot now? (y) or (n): "
if [ $REPLY = "y" ]; then
reboot
sudo reboot
fi
exit 0
}
Expand Down
2 changes: 2 additions & 0 deletions rules/61-onbattery.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Rule for when switching to battery
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="0",RUN+="/usr/bin/powerprofilesctl set balanced"
2 changes: 2 additions & 0 deletions rules/62-onpower.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Rule for when switching to power supply
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="1",RUN+="/usr/bin/powerprofilesctl set performance"
39 changes: 0 additions & 39 deletions tools/fish_install.sh

This file was deleted.

30 changes: 0 additions & 30 deletions tools/git_install.sh

This file was deleted.

Loading