-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathupdate_system_image.sh
executable file
·138 lines (114 loc) · 4.68 KB
/
update_system_image.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
#******************************************************************************
# ZYNTHIAN PROJECT: Script for Updating a System Image (SD image)
#
# Update an image and prepare it for repacking
#
# Copyright (C) 2015-2021 Fernando Moyano <[email protected]>
#
#******************************************************************************
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or 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 General Public License for more details.
#
# For a full copy of the GNU General Public License see the LICENSE.txt file.
#
#******************************************************************************
#------------------------------------------------------------------------------
# Load Environment Variables
#------------------------------------------------------------------------------
source "$ZYNTHIAN_SYS_DIR/scripts/zynthian_envars_extended.sh"
source "$ZYNTHIAN_SYS_DIR/scripts/delayed_action_flags.sh"
export PATH=$PATH:/$ZYNTHIAN_SYS_DIR/scripts:/$ZYNTHIAN_SYS_DIR/sbin
#------------------------------------------------------------------------------
# Set repo branches
#------------------------------------------------------------------------------
export ZYNTHIAN_SYS_BRANCH="testing"
export ZYNTHIAN_UI_BRANCH="testing"
export ZYNTHIAN_ZYNCODER_BRANCH="testing"
export ZYNTHIAN_WEBCONF_BRANCH="testing"
export ZYNTHIAN_DATA_BRANCH="testing"
if [ $ZYNTHIAN_SYS_BRANCH ]; then
cd $ZYNTHIAN_SYS_DIR
git fetch
git checkout "$ZYNTHIAN_SYS_BRANCH"
fi
if [ $ZYNTHIAN_UI_BRANCH ]; then
cd $ZYNTHIAN_UI_DIR
git fetch
git checkout "$ZYNTHIAN_UI_BRANCH"
fi
if [ $ZYNTHIAN_ZYNCODER_BRANCH ]; then
cd $ZYNTHIAN_DIR/zyncoder
git fetch
git checkout "$ZYNTHIAN_ZYNCODER_BRANCH"
fi
if [ $ZYNTHIAN_WEBCONF_BRANCH ]; then
cd $ZYNTHIAN_DIR/zynthian-webconf
git fetch
git checkout "$ZYNTHIAN_WEBCONF_BRANCH"
fi
if [ $ZYNTHIAN_DATA_BRANCH ]; then
cd $ZYNTHIAN_DATA_DIR
git fetch
git checkout "$ZYNTHIAN_DATA_BRANCH"
fi
#------------------------------------------------------------------------------
# Pull from zynthian-sys repotory ...
#------------------------------------------------------------------------------
echo "Updating zynthian-sys ..."
cd $ZYNTHIAN_SYS_DIR
git checkout .
git pull
#------------------------------------------------------------------------------
# Call update subscripts ...
#------------------------------------------------------------------------------
echo "UPDATING ZYNTHIAN ..."
cd ./scripts
./update_zynthian_recipes.sh
./recipes/install_cmake.sh
./update_zynthian_data.sh
./update_zynthian_sys.sh
./update_zynthian_code.sh
#------------------------------------------------------------------------------
# Update System ...
#------------------------------------------------------------------------------
#apt-get -y update --allow-releaseinfo-change
#apt-get -y upgrade
#------------------------------------------------------------------------------
# Adjustments ...
#------------------------------------------------------------------------------
# Copy the plugins configuration that is strangely lost
cp "$ZYNTHIAN_SYS_DIR/config/default_jalv_plugins.json" "/zynthian/config/jalv/plugins.json"
# Copy default snapshots
cp -a $ZYNTHIAN_DATA_DIR/snapshots/* $ZYNTHIAN_MY_DATA_DIR/snapshots/000
# Copy MIDI examples
cp -a $ZYNTHIAN_DATA_DIR/mid/*.mid $ZYNTHIAN_MY_DATA_DIR/capture
#------------------------------------------------------------------------------
# Update TimeStamp, clean everything and ends...
#------------------------------------------------------------------------------
# Update Build Info TimeStamp
TIMESTAMP=$(date --rfc-3339=date)
sed -i "s/^Timestamp: [0-9\-]*/Timestamp: $TIMESTAMP/" $ZYNTHIAN_DIR/build_info.txt
# Delete logs
echo "Deleting system logs ..."
for f in /var/log/* /var/log/**/* ; do
if [ -f $f ]; then
cat /dev/null > $f
fi
done
# Clean history
echo "Cleaning shell history ..."
cat /dev/null > ~/.bash_history && history -c && history -w
#------------------------------------------------------------------------------
# Enable first-boot service => It's already enabled!
#------------------------------------------------------------------------------
#./set_first_boot.sh
#------------------------------------------------------------------------------