diff --git a/README.md b/README.md index 769be16..3c4bae5 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ You can use the `-f` parameter with a filename. Please submit the data in the pl This is a description on how to set everything up if you did a git clone. You can also just do ``` -curl -fsSL https://raw.githubusercontent.com/green-coding-berlin/hog/main/install.sh | sudo bash +sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/green-coding-berlin/hog/main/install.sh)" ``` which will do the whole install for you. @@ -132,7 +132,7 @@ We currently don't support an automatic update. You will have to: - Rerun in the install script which will overwrite any custom changes you have made! ``` sudo mv /etc/hog_settings.ini /etc/hog_settings.ini.back -curl -fsSL https://raw.githubusercontent.com/green-coding-berlin/hog/main/install.sh | sudo bash +sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/green-coding-berlin/hog/main/install.sh)" ``` ## Contributing @@ -141,6 +141,35 @@ PRs are always welcome. Feel free to drop us an email or look into the issues. The hog is developed to not need any dependencies. +## Debugging + +It sometimes help to enable debugging for the logger process you can do this by editing the `/Library/LaunchDaemons/berlin.green-coding.hog.plist` file: +``` + + + + + Label + berlin.green-coding.hog + + ProgramArguments + + /usr/local/bin/hog/power_logger.py + -v + debug + -o + /tmp/hog.log + + + RunAtLoad + + + KeepAlive + + +``` +Please remember that the log file can become quite big. The hog does not use logrotate or similar out of the box. + ## Screenshots diff --git a/app/hog/hog.xcodeproj/project.xcworkspace/xcuserdata/didi.xcuserdatad/UserInterfaceState.xcuserstate b/app/hog/hog.xcodeproj/project.xcworkspace/xcuserdata/didi.xcuserdatad/UserInterfaceState.xcuserstate index 7ab89f7..794fe0a 100644 Binary files a/app/hog/hog.xcodeproj/project.xcworkspace/xcuserdata/didi.xcuserdatad/UserInterfaceState.xcuserstate and b/app/hog/hog.xcodeproj/project.xcworkspace/xcuserdata/didi.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/app/hog/hog/InstallView.swift b/app/hog/hog/InstallView.swift index 4419bee..d2c61c5 100644 --- a/app/hog/hog/InstallView.swift +++ b/app/hog/hog/InstallView.swift @@ -47,7 +47,7 @@ struct CopyPasteTextField: NSViewRepresentable { struct TwoView: View { - @State private var text = "curl -fsSL https://raw.githubusercontent.com/green-coding-berlin/hog/main/install.sh | sudo bash" + @State private var text = "sudo bash -c \"$(curl -fsSL https://raw.githubusercontent.com/green-coding-berlin/hog/main/install.sh)\"" var body: some View { Text("2) Run this command").font(.headline) diff --git a/hog.app/Contents/MacOS/hog b/hog.app/Contents/MacOS/hog index 5181d0f..100e89e 100755 Binary files a/hog.app/Contents/MacOS/hog and b/hog.app/Contents/MacOS/hog differ diff --git a/install.sh b/install.sh index f1b2a00..71555ce 100755 --- a/install.sh +++ b/install.sh @@ -61,14 +61,18 @@ chmod +x /usr/local/bin/hog/power_logger.py # Writing the config file ### -read -p "In order for the app to work with all features please allow us to upload some data. [Y/n]: " upload_data -upload_data=${upload_data:-Y} -upload_data=$(echo "$upload_data" | tr '[:upper:]' '[:lower:]') - -if [[ $upload_data == "y" || $upload_data == "yes" ]]; then - upload_flag="true" +if [[ -t 0 ]]; then # Check if input is from a terminal + read -p "In order for the app to work with all features please allow us to upload some data. [Y/n]: " upload_data + upload_data=${upload_data:-Y} + upload_data=$(echo "$upload_data" | tr '[:upper:]' '[:lower:]') + + if [[ $upload_data == "y" || $upload_data == "yes" ]]; then + upload_flag="true" + else + upload_flag="false" + fi else - upload_flag="false" + upload_flag="true" fi cat > /etc/hog_settings.ini << EOF @@ -89,7 +93,7 @@ echo "Configuration written to /etc/hog_settings.ini" mv -f /usr/local/bin/hog/berlin.green-coding.hog.plist /Library/LaunchDaemons/berlin.green-coding.hog.plist -sed -i '' "s|PATH_PLEASE_CHANGE|/usr/local/bin/hog/|g" /Library/LaunchDaemons/berlin.green-coding.hog.plist +sed -i '' "s|PATH_PLEASE_CHANGE|/usr/local/bin/hog|g" /Library/LaunchDaemons/berlin.green-coding.hog.plist chown root:wheel /Library/LaunchDaemons/berlin.green-coding.hog.plist chmod 644 /Library/LaunchDaemons/berlin.green-coding.hog.plist