Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
ddc78f21
Commit
ddc78f21
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Add mpd app
parent
428e264e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-app-mpd
+223
-0
223 additions, 0 deletions
src/freedombone-app-mpd
src/freedombone-app-nextcloud
+6
-0
6 additions, 0 deletions
src/freedombone-app-nextcloud
with
229 additions
and
0 deletions
src/freedombone-app-mpd
0 → 100755
+
223
−
0
View file @
ddc78f21
#!/bin/bash
#
# _____ _ _
# | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
# | __| _| -_| -_| . | . | | . | . | | -_|
# |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
#
# Freedom in the Cloud
#
# License
# =======
#
# Copyright (C) 2019 Bob Mottram <bob@freedombone.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VARIANTS
=
'full full-vim'
APP_CATEGORY
=
media
IN_DEFAULT_INSTALL
=
0
INSTALLED_ON_DEFAULT_DOMAIN
=
0
SHOW_ON_ABOUT
=
1
# whether to show the domain name in the web UI
SHOW_DOMAIN_IN_WEBADMIN
=
0
NOT_ON_API
=
0
# Whether to show on http://freedombone/home
NOT_ON_HOMEPAGE
=
0
# Whether another app is required to be installed before this one
REQUIRES_APP
=
MPD_DOMAIN_NAME
=
MPD_PORT
=
6600
# These parameters are used by the FreedomBox mobile app and web UI
MPD_SHORT_DESCRIPTION
=
"Play your music files"
MPD_DESCRIPTION
=
"Play your music files"
MPD_MOBILE_APP_URL
=
https://f-droid.org/en/packages/org.gateshipone.malp
mpd_variables
=(
ONION_ONLY
MY_USERNAME
)
function
mpd_nextcloud_integration
{
if
[
!
-f
/etc/mpd.conf
]
;
then
return
fi
read_config_param NEXTCLOUD_DOMAIN_NAME
read_config_param MY_USERNAME
mpd_nextcloud_dir
=
"/var/www/
$NEXTCLOUD_DOMAIN_NAME
/data/
$MY_USERNAME
/files"
if
[
-d
"
$mpd_nextcloud_dir
"
]
;
then
if
!
grep
-q
"
${
mpd_nextcloud_dir
}
/Music"
/etc/mpd.conf
;
then
sed
-i
"s|music_directory.*|music_directory
\"
${
mpd_nextcloud_dir
}
/Music
\"
|g"
/etc/mpd.conf
systemctl restart mpd
fi
else
if
!
grep
-q
"
\"
/music
\"
"
/etc/mpd.conf
;
then
sed
-i
"s|music_directory.*|music_directory
\"
/music
\"
|g"
/etc/mpd.conf
systemctl restart mpd
fi
fi
}
function
change_default_domain_name_mpd
{
new_default_domain_name
=
"
$1
"
# If anything references DEFAULT_DOMAIN_NAME then change it here
}
function
logging_on_mpd
{
echo
-n
''
}
function
logging_off_mpd
{
echo
-n
''
}
function
remove_user_mpd
{
remove_username
=
"
$1
"
"
${
PROJECT_NAME
}
-pass"
-u
"
$remove_username
"
--rmapp
mpd
}
function
add_user_mpd
{
new_username
=
"
$1
"
new_user_password
=
"
$2
"
"
${
PROJECT_NAME
}
-pass"
-u
"
$new_username
"
-a
mpd
-p
"
$new_user_password
"
echo
'0'
}
function
install_interactive_mpd
{
echo
-n
''
APP_INSTALLED
=
1
}
function
change_password_mpd
{
curr_username
=
"
$1
"
new_user_password
=
"
$2
"
read_config_param MY_USERNAME
if
[[
"
$curr_username
"
==
"
$MY_USERNAME
"
]]
;
then
sed
-i
"s|password.*|password
\"
${
new_user_password
}
@read,add,control,admin
\"
"
;
systemctl restart mpd
fi
"
${
PROJECT_NAME
}
-pass"
-u
"
$curr_username
"
-a
mpd
-p
"
$new_user_password
"
}
function
reconfigure_mpd
{
# This is used if you need to switch identity. Dump old keys and generate new ones
echo
-n
''
}
function
upgrade_mpd
{
mpd_nextcloud_integration
}
function
backup_local_mpd
{
echo
-n
''
}
function
restore_local_mpd
{
echo
-n
''
}
function
backup_remote_mpd
{
echo
-n
''
}
function
restore_remote_mpd
{
echo
-n
''
}
function
remove_mpd
{
remove_onion_service mpd
"
${
MPD_PORT
}
"
if
grep
-q
"mpd"
/etc/crontab
;
then
sed
-i
"/mpd/d"
/etc/crontab
fi
remove_app mpd
remove_completion_param install_mpd
sed
-i
'/mpd/d'
"
$COMPLETION_FILE
"
firewall_remove
$MPD_PORT
tcp
firewall_remove
$MPD_PORT
udp
}
function
mpd_create_configuration
{
mpd_music_dir
=
'/music'
{
echo
"music_directory
\"
${
mpd_music_dir
}
\"
"
;
echo
'playlist_directory "/var/lib/mpd/playlists"'
;
echo
'db_file "/var/lib/mpd/tag_cache"'
;
echo
'log_file "/dev/null"'
;
echo
'pid_file "/run/mpd/pid"'
;
echo
'state_file "/var/lib/mpd/state"'
;
echo
'sticker_file "/var/lib/mpd/sticker.sql"'
;
echo
'#user "mpd"'
;
echo
'bind_to_address "any"'
;
echo
"port
\"
${
MPD_PORT
}
\"
"
;
echo
'log_level "default"'
;
echo
'auto_update "yes"'
;
echo
'follow_outside_symlinks "no"'
;
echo
'follow_inside_symlinks "no"'
;
echo
'zeroconf_enabled "yes"'
;
echo
'zeroconf_name "Music Player"'
;
echo
"password
\"
${
MPD_ADMIN_PASSWORD
}
@read,add,control,admin
\"
"
;
echo
'input {'
;
echo
' plugin "curl"'
;
echo
'}'
;
echo
'audio_output {'
;
echo
' type "alsa"'
;
echo
' name "My ALSA Device"'
;
echo
'}'
;
}
>
/etc/mpd.conf
systemctl restart mpd
}
function
install_mpd
{
increment_app_install_progress
$INSTALL_PACKAGES
alsa-utils
increment_app_install_progress
$INSTALL_PACKAGES
mpd
increment_app_install_progress
MPD_ONION_HOSTNAME
=
$(
add_onion_service mpd
"
${
MPD_PORT
}
"
"
${
MPD_PORT
}
"
)
increment_app_install_progress
"
${
PROJECT_NAME
}
-pass"
-u
"
$MY_USERNAME
"
-a
mpd
-p
"
$MPD_ADMIN_PASSWORD
"
increment_app_install_progress
firewall_add mpd
$MPD_PORT
tcp
firewall_add mpd
$MPD_PORT
udp
mpd_create_configuration
increment_app_install_progress
mpd_nextcloud_integration
APP_INSTALLED
=
1
}
# NOTE: deliberately there is no "exit 0"
This diff is collapsed.
Click to expand it.
src/freedombone-app-nextcloud
+
6
−
0
View file @
ddc78f21
...
...
@@ -275,6 +275,7 @@ function upgrade_nextcloud_base {
${NEXTCLOUD_COMMAND} maintenance:mode --off
${NEXTCLOUD_COMMAND} db:add-missing-indices
${NEXTCLOUD_COMMAND} -n db:convert-filecache-bigint
mpd_nextcloud_integration
}
function upgrade_nextcloud {
...
...
@@ -405,6 +406,7 @@ function remove_nextcloud {
if [ -f "/etc/nginx/sites-available/$NEXTCLOUD_DOMAIN_NAME" ]; then
rm "/etc/nginx/sites-available/$NEXTCLOUD_DOMAIN_NAME"
fi
mpd_nextcloud_integration
function_check drop_database
drop_database nextcloud
function_check remove_onion_service
...
...
@@ -817,6 +819,10 @@ function install_nextcloud {
install_nextcloud_main
increment_app_install_progress
mpd_nextcloud_integration
APP_INSTALLED
=
1
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment