-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
# Enter code owners here: | ||
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners | ||
# | ||
# Example: | ||
# * <your username> | ||
* @wickdchromosome |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
--- | ||
|
||
# Example variable | ||
potos_template_example_var: 'hello world!' | ||
|
||
# List of items used for action xyz | ||
potos_template_example_list: [] | ||
# Int between 0 and 65536(0-100%), for setting | ||
# PulseAudio default volume | ||
potos_xdg_autostart: | ||
- script: "pulseaudio_example.sh.j2" | ||
runonlyonce: true | ||
potos_pulseaudio_default_volume: 50000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Disable this script | ||
script_name=$(basename "$0") | ||
mkdir -p "$HOME/.config/autostart/" | ||
cp "/etc/xdg/autostart/$script_name.desktop" "$HOME/.config/autostart/$script_name.desktop" | ||
sed -i 's/X-GNOME-Autostart-enabled=true/X-GNOME-Autostart-enabled=false/g' "$HOME/.config/autostart/$script_name.desktop" | ||
chmod +x "$HOME/.config/autostart/$script_name.sh.desktop" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
touch $HOME/"$0"_worked.txt | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
touch $HOME/"$0"_worked.txt | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,50 @@ | ||
--- | ||
|
||
- name: Example task to deploy a template | ||
# Loop over all script names, make an autostart desktopfile for each | ||
- name: Copy over the desktop file to the new dir | ||
ansible.builtin.template: | ||
src: 'potos.example.j2' | ||
dest: '/potos.example' | ||
owner: root | ||
group: root | ||
mode: '0755' | ||
src: "potos_xdgautostart/etc/xdg/autostart/desktopfile.j2" | ||
Check warning on line 6 in tasks/main.yml GitHub Actions / test (ubuntu20)jinja[spacing]
Check warning on line 6 in tasks/main.yml GitHub Actions / test (ubuntu22)jinja[spacing]
|
||
dest: "/etc/xdg/autostart/{{ item.script | replace('.j2','') }}_wrapper.sh.desktop" | ||
force: true | ||
mode: '0777' | ||
loop: "{{ potos_xdg_autostart }}" | ||
|
||
# Copy over script file to global autostart dir | ||
- name: Copy over the script file to the new dir | ||
ansible.builtin.template: | ||
src: "potos_xdgautostart/usr/local/bin/{{ item.script }}" | ||
Check warning on line 15 in tasks/main.yml GitHub Actions / test (ubuntu20)jinja[spacing]
|
||
dest: "/usr/local/bin/{{ item.script | replace('.j2','') }}" | ||
force: true | ||
mode: '0777' | ||
loop: "{{ potos_xdg_autostart }}" | ||
failed_when: false | ||
|
||
# Check to make sure target script file is on the remote host, | ||
# either because it was copied over or it was already there | ||
- name: Make sure target script file is present | ||
ansible.builtin.stat: | ||
path: "/usr/local/bin/{{ item.script | replace('.j2','') }}" | ||
Check warning on line 26 in tasks/main.yml GitHub Actions / test (ubuntu20)jinja[spacing]
|
||
register: file_stat | ||
failed_when: not file_stat.stat.exists | ||
loop: "{{ potos_xdg_autostart }}" | ||
|
||
# Create the script wrapper file to global autostart dir | ||
- name: Copy over the script file wrapper to the new dir | ||
ansible.builtin.lineinfile: | ||
path: "/usr/local/bin/{{ item.script | replace('.j2','') }}_wrapper.sh" | ||
Check warning on line 34 in tasks/main.yml GitHub Actions / test (ubuntu20)jinja[spacing]
Check warning on line 34 in tasks/main.yml GitHub Actions / test (ubuntu20)jinja[spacing]
Check warning on line 34 in tasks/main.yml GitHub Actions / test (ubuntu20)jinja[spacing]
Check warning on line 34 in tasks/main.yml GitHub Actions / test (ubuntu22)jinja[spacing]
Check warning on line 34 in tasks/main.yml GitHub Actions / test (ubuntu22)jinja[spacing]
|
||
line: "/usr/local/bin/{{ item.script | replace('.j2','') }}" | ||
regexp: "^/usr/local/bin/{{ item.script | replace('.j2','') }}$" | ||
state: present | ||
backup: false | ||
create: true | ||
mode: '0777' | ||
loop: "{{ potos_xdg_autostart }}" | ||
|
||
# Append disable script to each copied over script | ||
- name: Add disable script to wrapper | ||
ansible.builtin.blockinfile: | ||
path: "/usr/local/bin/{{ item.script | replace('.j2','') }}_wrapper.sh" | ||
Check warning on line 46 in tasks/main.yml GitHub Actions / test (ubuntu20)jinja[spacing]
|
||
block: "{{ lookup('file', 'files/disable_script.sh') }}" | ||
state: present | ||
loop: "{{ potos_xdg_autostart }}" | ||
when: item.runonlyonce |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{ ansible_managed | comment }} | ||
[Desktop Entry] | ||
Type=Application | ||
Name=Potos autostart script for {{ item.script | replace('.j2','') }} | ||
Comment=Potos autostart script for {{ item.script | replace('.j2','') }} | ||
Exec=/usr/local/bin/{{ item.script | replace('.j2','') }}_wrapper.sh | ||
X-GNOME-AutoRestart=false | ||
X-GNOME-Autostart-enabled=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
{{ ansible_managed | comment }} | ||
|
||
# Set default sink volume for user | ||
potos_pulseaudio_defsink=$( pactl info | awk '/Default Sink:/ {print $3}' ) | ||
pactl set-sink-mute $potos_pulseaudio_defsink 0 # Make sure its unmuted | ||
pactl set-sink-volume $potos_pulseaudio_defsink "{{ item.potos_pulseaudio_default_volume }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
MOLECULE_DISTRO="ubuntu22" molecule test |