(row: any)
| 135 | } |
| 136 | |
| 137 | const handleVersion = async (row: any) => { |
| 138 | if (MacPortsSetup.installing) { |
| 139 | return |
| 140 | } |
| 141 | MacPortsSetup.installing = true |
| 142 | MacPortsSetup.installEnd = false |
| 143 | let fn = '' |
| 144 | if (row.installed) { |
| 145 | fn = 'uninstall' |
| 146 | } else { |
| 147 | fn = 'install' |
| 148 | } |
| 149 | const arch = window.Server.isArmArch ? '-arm64' : '-x86_64' |
| 150 | const name = row.name |
| 151 | let params = [] |
| 152 | |
| 153 | const names = [name] |
| 154 | if (typeFlag === 'php') { |
| 155 | names.push(`${name}-fpm`, `${name}-mysql`, `${name}-apache2handler`, `${name}-iconv`) |
| 156 | } else if (typeFlag === 'mysql') { |
| 157 | names.push(`${name}-server`) |
| 158 | } else if (typeFlag === 'mariadb') { |
| 159 | names.push(`${name}-server`) |
| 160 | } else if (typeFlag === 'python') { |
| 161 | names.push(`${name.replace('python', 'py')}-pip`) |
| 162 | } |
| 163 | if (['php52', 'php53', 'php54', 'php55', 'php56'].includes(name) && fn === 'install') { |
| 164 | const sh = join(window.Server.Static!, 'sh/port-cmd-user.sh') |
| 165 | const copyfile = join(window.Server.Cache!, 'port-cmd-user.sh') |
| 166 | const exists = await fs.existsSync(copyfile) |
| 167 | if (exists) { |
| 168 | await fs.remove(copyfile) |
| 169 | } |
| 170 | const libs = names.join(' ') |
| 171 | const arrs = [ |
| 172 | `echo "arch ${arch} sudo port clean -v ${libs}"`, |
| 173 | `arch ${arch} sudo -S port clean -v ${libs}` |
| 174 | ] |
| 175 | names.forEach((name) => { |
| 176 | arrs.push( |
| 177 | `echo "arch ${arch} sudo port install -v ${name} configure.compiler=macports-clang-10"` |
| 178 | ) |
| 179 | arrs.push( |
| 180 | `arch ${arch} sudo -S port install -v ${name} configure.compiler=macports-clang-10` |
| 181 | ) |
| 182 | }) |
| 183 | arrs.unshift(`arch ${arch} sudo -S port -f deactivate libuuid`) |
| 184 | let content = await fs.readFile(sh) |
| 185 | content = content.replace('##CONTENT##', arrs.join('\n')) |
| 186 | await fs.writeFile(copyfile, content) |
| 187 | await fs.chmod(copyfile, '0777') |
| 188 | params = [`sudo -S "${copyfile}"`] |
| 189 | } else { |
| 190 | const sh = join(window.Server.Static!, 'sh/port-cmd.sh') |
| 191 | const copyfile = join(window.Server.Cache!, 'port-cmd.sh') |
| 192 | const exists = await fs.existsSync(copyfile) |
| 193 | if (exists) { |
| 194 | await fs.remove(copyfile) |
nothing calls this directly
no test coverage detected